Lamez Posted January 11, 2009 Share Posted January 11, 2009 I am using the PHP mail function to send activation emails to the newly registered member. Well it worked with gmail, but yahoo does not seem to receive anything at all. Are there alternative ways of sending emails? Here is my code: <?php function sendMail($user){ $to = findInfo($user, "email"); $id = findInfo($user, "id"); $hash = md5($user.$id.$user); $link = "http://www.lamezz.com/test/register.php?act=".$hash; $subject = 'Activate Account!'; $message = "Please copy and paste the link into your browser to activate your account at Lamez's Corner! \n".$link."\n -Thank You\n Lamez"); $headers = "From: no-reply@lamezz.com\r\nReply-To: no-reply@lamezz.com"; $mail_sent = @mail( $to, $subject, $message, $headers ); return $mail_sent ? "Mail sent to ".$to : "Mail failed"; } ?> Quote Link to comment Share on other sites More sharing options...
Rushyo Posted January 11, 2009 Share Posted January 11, 2009 The PEAR library has a mail function which is quite powerful. Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822. Quote Link to comment Share on other sites More sharing options...
redarrow Posted January 11, 2009 Share Posted January 11, 2009 If you add the more constructed header's your get there, most email server wont let email's in unless there headers are properly formatted. Also email's get seen as spam unless the ip sending the email is on there non spamming list. For example. If you join a hosting account that has been reported as a host that has lots off spam your xxxxxxxxxx or the host has not set the dns correctly your xxxxxx There many things wrong with your current posted code, for established email servers to accept your email's. lack off header info is one. Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 11, 2009 Author Share Posted January 11, 2009 so my headers might be incorrect, and that could be the problem? Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 11, 2009 Author Share Posted January 11, 2009 would sending emails using SMTP Authentication practical? Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 11, 2009 Author Share Posted January 11, 2009 ya I used pear and SMTP to send mail, and it works great! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.