PHP的邮件设置 – 适合我的设置值

我们使用托pipe公司为我们的网站,但我们有我们的邮件服务器托pipe我们的网站与我们的域名; @ sample.net。

SMTP mail.isp.com 

在网站上,我们有一个联系表格,用户提交后会发邮件到[email protected]

使用默认设置:

 SMTP localhost sendmail_path /usr/sbin/sendmail -t -i 

和自定义设置:

  sendmail_from [email protected] 

我能够成功地将邮件发送到@ sample.com以外的其他域。 看着这个我相信这是因为SMTP是本地主机,没有正确指出我们的ISP邮件服务器。

如果我有一个外部公司托pipe我们的邮件服务器由我们的ISP托pipe的网站,我会把什么价值?

除了@adamo说的确实很可能,你也可以尝试使用PEAR :: Mail发送邮件 。

下面是一些来自unixcraft的示例代码,你可以试试。

 <?php include("Mail.php"); /* mail setup recipients, subject etc */ $recipients = "[email protected]"; $headers["From"] = "[email protected]"; $headers["To"] = "[email protected]"; $headers["Subject"] = "User feedback"; $mailmsg = "Hello, This is a test."; /* SMTP server name, port, user/passwd */ $smtpinfo["host"] = "smtp.mycorp.com"; $smtpinfo["port"] = "25"; $smtpinfo["auth"] = true; $smtpinfo["username"] = "smtpusername"; $smtpinfo["password"] = "smtpPassword"; /* Create the mail object using the Mail::factory method */ $mail_object =& Mail::factory("smtp", $smtpinfo); /* Ok send mail */ $mail_object->send($recipients, $headers, $mailmsg); ?> 

另一种解决scheme(如果你想所有的邮件都通过远程邮件服务器)是configurationSSMTP作为你的sendmail二进制文件。

问题是,您的域名的MX服务器(在您的ISP)不接受从其他地方(在ISP之外)发送的声称为合法的邮件。 您必须联系您的ISP的邮件技术支持(这不是“我的前景不行”风格的一级支持请求)并解决此问题。

我在这里博客了类似的情况。

在你的情况下,简单的解决scheme可能是ISP允许您的networking主机连接到smtp.sample.net并从那里发送邮件。