Send account activation link via email PHP

WhyME

Senior Member
Joined
Feb 2, 2010
Messages
615
Reaction score
8
Location
Johannesburg
Some advise please: hosting with AfriHost, we are buys coding to send email link upon registration to validate that the email registering belongs to the user.

However the email is unsuccessfully sent if I use Afrihost email that I setup but it works fine with gmail?
 
This is how I'm sending an activation email from my web site , and I happen to host with Afrihost aswell.


//SEND ACTIVATION EMAIL
$to = $fEmail;
$subject = 'Your grb Account has been successfully created.';
$headers = "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message = '<html><body>';
$message .= '<h1>grb Activation</h1>
<h3>Hey There! Thanks for registering with grb.</h3>
<h4>Your grb Account has been successfully created.</h4>
<h5>In order to login you need to activate your account.
Please click <a href="http://www.mysite.com/grb/activateaccount.php?key=' . $ActivationKey . '">Activate Now</a> to verify your account.</h5>


';
$message .= '</body></html>';
mail($to, $subject, $message, $headers);
 
Don’t use mail. Use a proper SMTP class like phpMailer it even better yet, use www.mailgun.com. Default mail func in PHP you’ll find most landing up in junk mail or just not leaving the server at all. Chuck it and build a proper mailing system.
 
Don’t use mail. Use a proper SMTP class like phpMailer it even better yet, use www.mailgun.com. Default mail func in PHP you’ll find most landing up in junk mail or just not leaving the server at all. Chuck it and build a proper mailing system.

This is very good advice. Plus phpMailer is only slightly more complicated to code than the built in mail.

Also, if you are developing on Windows (Ja, I know, it's a PHP question, but some madmen do this) then while you are doing dev I recommend a 'fake' local SMTP server to check what you are sending.

This one rocks:

https://github.com/ChangemakerStudios/Papercut
 
Thanks guy for advise, we managed to get email to go out however it takes 5 minutes to dispatch, any ideas? As mentioned above hosting with Afrihost.

The email dont go to JUNK/SPAM.

@SBSP
@Kwerty
@Ray7905
@scudsucker
@_kabal_
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X