Hi guys, first at all, i'm so sorry about the bad english.
After four years I will "play" again with tt, and my "first" contribution now will be a thing that is not really necessary but it was for me.
The torrent trader (at least in the version 2.08) send emails by "native" php function mail and by the mail class of pear.
In my case none of these methods worked, because I have a VPS poorly configurated.
Is so boring configure a local smtp for linux (to use native mail) and I don't have (and actually I don't want to know how) install the pear libraries, so I made a mod to send e-mail through the PHPMailer.
PHPMailer is a mail library (duh), but it's not updated anymore (I guess), but works fine.
OK, lets stop talk and begin write.
I'm using TorrenTrader 2.08 clean, no mods, no nothing (but it's not a trouble).
First, download the phpmailer library at [url="
https://github.com/Synchro/PHPMailer"]https://github.com/Synchro/PHPMailer[/url] (official website in case they don't use git anymore [url="
http://phpmailer.worxware.com/"]http://phpmailer.worxware.com/[/url]) and download the following files:
- PHPMailerAutoload.php
- class.phpmailer.php
- class.pop3.php
- class.smtp.php
Now create a folder called "phpmailer" on your trader root website (the upload folder) and put the four files there (please, don't rename them).
Fine! Now, let's edit your backend/mail.php file.
Find (49, 50):
break;
case "php":
and them replace by:
break;
case "phpmailer":
$this->type = "phpmailer";
$file_phpmailer_autoload = realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'phpmailer' . DIRECTORY_SEPARATOR . 'PHPMailerAutoload.php';
require_once $file_phpmailer_autoload;
break;
case "php":
Find (line 83, 84, 85, 86. 87?):
$mail = $smtp->send($to, $headers, $message);
break;
case "php":
@mail($to, $subject, $message, $additional_headers, $additional_parameters);
and them replace by:
$mail = $smtp->send($to, $headers, $message);
break;
case "phpmailer":
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
$mail->IsHTML(true); //Set to true or false, you decide
$mail->SMTPDebug = 0;
$mail->Host = $site_config["mail_smtp_host"];
$mail->Port = $site_config["mail_smtp_port"];
$mail->SMTPAuth = $site_config["mail_smtp_auth"];
if ($site_config["mail_smtp_ssl"]) {
$mail->SMTPSecure = "ssl";
}
$mail->Username = $site_config["mail_smtp_user"];
$mail->Password = $site_config["mail_smtp_pass"];
$mail->setFrom($site_config['SITEEMAIL'], $site_config['SITENAME']);
$mail->addReplyTo($site_config['SITEEMAIL'], $site_config['SITENAME']);
$mail->addAddress($to);
$mail->Subject = $subject;
$mail->msgHTML($message);
@$mail->send();
//Clear destinataries and attachments
$mail->ClearAllRecipients();
$mail->ClearAttachments();
break;
case "php":
@mail($to, $subject, $message, $additional_headers, $additional_parameters);
Now, we have to configure our tracker to send e-mails via this new method, so, just if you want to change, edit your config.php
Find:
$site_config["mail_type"] = "???";
"???" will be "php" ou "pear". Now, change it for "phpmailer";
$site_config["mail_type"] = "phpmailer";
In the next lines, there are the smtp configuration, this I cant help you because it depends of your mail server.
If you will use gmail, use the following configurations:
$site_config["mail_smtp_host"] = "smtp.gmail.com"; // SMTP server hostname
$site_config["mail_smtp_port"] = "465"; // SMTP server port
$site_config["mail_smtp_ssl"] = true; // true to use SSL
$site_config["mail_smtp_auth"] = true; // true to use auth for SMTP
$site_config["mail_smtp_user"] = "all_the_text_before_the_@_of_your_email"; // SMTP username
$site_config["mail_smtp_pass"] = "your_gmail_password"; // SMTP password
I hope it can help someone.
PS.: I prefer phpmail because not always the servers has the native mail function well configurated (and most of the time the e-mail go to spam) and not always the servers has the pear libraries installed, so phpmailer should work better in the most of the time.
PPS.: phpmailer needs the php sockets working, so, phpmailer it's not 100% functional, but I NEVER see a server with socket for php disabled.
And for the lazy ones, I attached the phpmailer files here (just kidding, just in case of phpmailer blows-up)
[url="
http://devscorner.xyz/applications/core/interface/file/attachment.php?id=7017"]phpmailer.zip[/url]