i ve got a php function which sents emailsvy, but I would it to use the smtp services i have specified ini.set function.
如果删除这三条编码线,则电子邮件仍有罚款。
想使用冲积机的原因是,有时这并不适用于某些邮件接收处。
connect();
$username = mysql_real_escape_string($_POST[ username ]);
$result = mysql_query("SELECT email FROM members WHERE username = $_POST[username] ")
or die ("Error - Something went wrong.");
$row = mysql_fetch_array($result);
$useremail = $row[ email ];
$name = "name";
$mail_from = "noreply@name.com";
$mail_to = "$useremail";
$mail_body = "Hello. Thank you for registering. Please click the link below to confirm your email address. ";
$mail_subject = "Confirm you registration".$name;
$mail_header = "From: ".$name." <".$mail_from.">
";
ini_set ("SMTP", "ssl://serveraddress");
ini_set("smtp_port","465");
ini_set("sendmail_from","noreply@name.com");
$sendmail = mail($mail_to, $mail_subject, $mail_body, $mail_header);
if($sendmail == true) { mail("john@name.com", "email sent ok", "email sent to $_POST[email] ", "yea sent ok");}
Else { mail("john@name.com", "email ERROR", "email not sent to $_POST[email] ", "yea we got a problem");}
}