Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I want to send auto response mail from my gmail account but I am getting this error

SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. k4sm5538005pbd.11 - gsmtp in


my code is here for email

XML
$to = "$e";
$from = "login.vyara@gmail.com";
$subject = 'maxdudes Account Activation';

//$message = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>yoursitename Message</title></head><body style="margin:0px; font-family:Tahoma, Geneva, sans-serif;"><div style="padding:10px; background:#333; font-size:24px; color:#CCC;"><a href="http://www.maxdudes.com"></a>maxdudes Account Activation</div><div style="padding:24px; font-size:17px;">Hello '.$u.',<br /><br />Click the link below to activate your account when ready:<br /><br /><a href="http://www.maxdudes.com/activation.php?id='.$uid.'&u='.$u.'&e='.$e.'&p='.$p_hash.'">Click here to activate your account now</a><br /><br />Login after successful activation using your:<br />* E-mail Address: <b>'.$e.'</b></div></body></html>';
$message = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>yoursitename Message</title></head><body style="margin:0px; font-family:Tahoma, Geneva, sans-serif;"><div style="padding:10px; background:#333; font-size:24px; color:#CCC;"><a href="http://www.yoursitename.com"><img src="http://www.yoursitename.com/images/logo.png" width="36" height="30" alt="yoursitename" style="border:none; float:left;"></a>yoursitename Account Activation</div><div style="padding:24px; font-size:17px;">Hello '.$u.',<br /><br />Click the link below to activate your account when ready:<br /><br /><a href="http://www.yoursitename.com/activation.php?id='.$uid.'&u='.$u.'&e='.$e.'&p='.$p_hash.'">Click here to activate your account now</a><br /><br />Login after successful activation using your:<br />* E-mail Address: <b>'.$e.'</b></div></body></html>';
    $headers = "From: $from\n";
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\n";
mail($to, $subject, $message, $headers);


echo "signup_success";
Posted

1 solution

This is because the SMTP server you are using happens to be configured to use the security layer called TLS, so the clients are required to use it: http://en.wikipedia.org/wiki/Transport_Layer_Security[^].

This problem applied to PHP and its solution is discussed in many places:
http://www.example-code.com/php/smtp_starttls.asp[^],
http://stackoverflow.com/questions/5265692/smtp-server-response-530-5-7-0-must-issue-a-starttls-command-first[^],
http://byitcurious.blogspot.com/2009/04/solving-must-issue-starttls-command.html[^].

You can always find all you need: http://bit.ly/1g5nJUD[^].

One approach is to use different API for sending mail, using the classes found in PEAR:
http://www.authsmtp.com/php-pear-mail/[^],
http://en.wikipedia.org/wiki/PEAR[^],
http://pear.php.net/[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900