【发布时间】:2014-09-01 11:22:34
【问题描述】:
代码:-
$mail = new PHPMailer();
$body="<b>This mail is sent using PHP Mailer</b>";#HTML tags can be included
$mail->IsSMTP();
$mail->SMTPAuth = true; #enable SMTP authentication
$mail->SMTPSecure = "tls"; #sets the prefix to the server
$mail->Host = "smtp.gmail.com"; #sets GMAIL as the SMTP server
$mail->Port = 587; #set the SMTP port
$mail->Username = "morelifelondon@gmail.com"; #your gmail username
$mail->Password = "***********"; #Your gmail password
$mail->From = $email;
$mail->FromName = $name ;
$mail->Subject = "Enquiry";
$mail->Body = $messages;
$mail->AddAddress("morelifelondon@gmail.com","contact");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Mail has Been Sent.';
}
}
我希望将 morelifelondon@gmail.com 替换为 abhishek@gmail.com。这可能吗 ?
【问题讨论】:
-
该地址在您的代码中出现了两次,如果它在
$email中可能会出现第三次(您尚未提供完整的代码)。你没有说你想改变哪个实例,尽管你需要做的就是改变它们。
标签: php ssl smtp gmail phpmailer