验证php邮件 [英] Authentication php mail
问题描述
我正在使用 mail
从PHP发送电子邮件.它工作正常,但是现在我需要使用更安全的邮件服务器.
I'm using mail
to send e-mails from PHP. It's working fine, but now I need to use a more secure mail server.
我需要使用以下配置连接到邮件服务器:
I need to connect with the mail server using the following configuration:
smtp: "mail.newserver.com"
port: "25"
timeout: 60
auth: yes
user: name
pass: word
我应该如何在下面更改我的代码,使其在上面的配置中起作用?
How should I change my code below so it works with above configuration?
$to = $SendTo;
$headers = "From: <info@---->" . "\r\n" . "X-Mailer: php";
$subject = "Website Contact : " . $uxGlobalLocation;
$body = $Bodycopy;
if (mail($to, $subject, $body, $headers)) {
header ('Location: /index.php?option');
exit();
} else {
echo("<p>Message delivery failed...</p>");
}
推荐答案
实际上,邮件功能不提供身份验证功能.您必须使用Mail Pear包中的Mail类. 请参见此处的示例: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
Actually mail function doesn't provide authentication functionality. Your have to use Mail class from Mail Pear package. See here for an example: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
这篇关于验证php邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!