Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
SMTP Signup Email (HTML)
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2020-07-15 10:25:14
So far this is done for account-signup.php, I have many area's to add this to. This replaces the old sendmail() email function, providing you HTML email templates
that let you pull more data or personalize better for users. Plain text is boring.

This sends a HTML welcome email to new user.

Required: PEAR Mail

https://pear.php.net/manual/en/package.mail.mail.factory.php

PEAR mail is excellent, I've been using it since our first 20 members (reaching 20K now) and its never failed once. I recommend it in general over sendmail.

Install:

Here are Linux instructions. I don't use Linux and I don't know it very well, but this will install under "Ubuntu". Install each line individually starting from top:

[color=rgb(44, 130, 201)]#[/color] [color=rgb(226, 80, 65)]sudo apt-get install php-pear[/color]

[color=rgb(44, 130, 201)]#[/color] [color=rgb(226, 80, 65)]sudo pear install mail[/color]

[color=rgb(44, 130, 201)]#[/color] [color=rgb(226, 80, 65)]sudo pear install Net_SMTP[/color]

Now, open account-signup.php and find


//send pm to new user
   if ($site_config["WELCOMEPMON"]){
       $dt = sqlesc(get_date_time());
       $msg = sqlesc($site_config["WELCOMEPMMSG"]);
       SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $id, $dt, $msg, 0)");
   }


Add after


if ($site_config["WELCOMEEMAIL"]) {
   require_once "Mail.php";
   $from    = $site_config['SITENAME'] . " <" . $site_config['SITEEMAIL'] . ">";
   $subject = "Welcome to " . $site_config['SITENAME'];
   $headers = array(
       'To' => $email,
       'From' => $from,
       'Subject' => $subject,
       'MIME-Version' => 1,
       'Content-type' => 'text/html;charset=iso-8859-1'
   );
   $smtp    = Mail::factory('smtp', array(
       'host' => $site_config["mail_smtp_host"],
       'auth' => $site_config["mail_smtp_auth"],
       'username' => $site_config["mail_smtp_user"],
       'password' => $site_config["mail_smtp_pass"]
   ));
   $mail    = $smtp->send($email, $headers, $site_config["WELCOMEEMAILBODY"]);
   // Log send error
   if (PEAR::isError($mail)) {
       write_log($mail->getMessage());
       return false;
   } else {
       write_log("Welcome Email successfully sent to " . $email);
   }
}


Now open backend/config.php and add


$site_config['WELCOMEEMAIL'] = true;
$site_config['WELCOMEEMAILBODY']  = '
<html>
<head>
<style>body{font-family:arial,sans-serif,helvetica;background-color:rgba(236,236,236,1);margin:0;padding:0}.email-header{background:width:100%;height:56px;margin-bottom:20px}.email-body{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);background:rgba(255,255,255,1);padding:10 10px 50px 10px;font-size:17px;width:90%;margin:0 auto;text-align:center;overflow:auto}.welcome-msg{font-size:30px;text-align:center;padding:0 20px 20px 0}.welcome-msg2{font-size:17px;text-align:center;padding:0 20px 20 0}.email-body .welcome-msg{padding-top:15px}.email-body a{margin-left:-20px;margin-top:10px}.btn-signin{box-shadow:inset 0 1px 0 0 rgba(242,156,147,1);background:linear-gradient(to bottom,rgba(254,26,0,1) 5%,rgba(206,1,0,1) 100%);background-color:rgba(254,26,0,1);border-radius:6px;border:1px solid rgba(216,53,38,1);display:inline-block;cursor:pointer;color:rgba(255,255,255,1);font-family:Arial;font-size:15px;font-weight:bold;padding:6px 24px;text-decoration:none;text-shadow:0 1px 0 rgba(178,62,53,1)}.btn-signin:hover{background:linear-gradient(to bottom,rgba(206,1,0,1) 5%,rgba(254,26,0,1) 100%);background-color:rgba(206,1,0,1)}.btn-signin:active{position:relative;top:1px}</style>
</head>
<body>
<div class="email-header">
</div>
<div class="welcome-msg">Welcome!</div>
<div class="welcome-msg2">Your account has been activated.</div>
<div class="email-body">
<div class="welcome-msg">Your only movie torrents!</div>
<div class="email-content">
This is my email body. Text will go here.
</div>
<div class="welcome-msg">Sign In</div>
<a href="https://TRACKER.com/signin/" class="btn-signin">Sign In</a>
</div>
</body>
</html>';
2020-07-15 18:47:20
Nice mod I'd put welcome message in database then you can edit in admin panel in textvbcode function  (y) you would need to query it then pass it as a var $welcomemessage
2020-07-16 00:35:43
"m-jay, post: 68834, member: 20288":

Nice mod I'd put welcome message in database then you can edit in admin panel in textvbcode function  (y) you would need to query it then pass it as a var $welcomemessage


Absolutely, that will be next
2020-07-16 09:14:22
Updated:
- Included HTML email template ready to go. Fully responsive and compressed. Just update TRACKER.com with your domain and your set!
- Added email reporting. Successfully sent emails write to Site Log in admincp, including error/failed with debug information.
2020-07-17 02:49:47
Would this work if you have another mail server running on the server that serves smtp?
Or does it only work with PEAR mail?
If It Ain't Dutch, It Ain't Much!!
2020-07-17 04:01:08
"Propaganda, post: 68838, member: 60":

Would this work if you have another mail server running on the server that serves smtp?
Or does it only work with PEAR mail?

Yes, in fact I highly advise using a SMTP relay server, like Gmail to send mail out. Otherwise, you will expose your origin IP in the mail headers, and this is impossible to mask without using another server other than your ISP. It is in nature of the protocol itself to include IP header data. So use SMTP relay for host in config setting.
2021-03-15 19:10:28
to use gmail, here are the config.php settings
// Mail settings
// php to use PHP's built-in mail function. or pear to use http://pear.php.net/Mail
// MUST use pear for SMTP
$site_config["mail_type"] = "pear"; //Use PEAR for Gmail, otherwise, use PHP
$site_config["mail_smtp_host"] = "smtp.gmail.com"; // SMTP server hostname. Google Gmail is smtp.gmail.com
$site_config["mail_smtp_port"] = "465"; // SMTP server port. Google Gmail uses 465
$site_config["mail_smtp_ssl"] = true; // true to use SSL. True for Google Gmail
$site_config["mail_smtp_auth"] = true; // true to use auth for SMTP. True for Google Gmail
$site_config["mail_smtp_user"] = "user"; // SMTP username. Will be your gmail account ie: your_gmail_addy@gmail.com
$site_config["mail_smtp_pass"] = "password"; // SMTP password. Gmail account password if using gmail

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-03-15 19:12:44
2021-03-15 22:52:06
And I get that when I try to send email from my server with gmail account on config.php

(delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[173.194.202.27]:25: No route to host)



www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2021-03-16 01:05:12
try removing postfix and only install what storrents posted above. Thats all I have installed, I just checked it. perhaps the postfix is messing it up.
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-03-16 16:42:15
Can't remove Postfix it is inegrated in CWP (Centos Web Panel)


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2021-03-20 02:19:57
Use a SMTP relay API, like I have posted before. You wont be disappointed.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728