如何在php中使用ssl通过smtp发送邮件

问题描述:

如何使用 ssl 通过 smtp 发送邮件?我们可以发送简单的文本邮件,但不允许邮件中的链接或某些标签通过,我们尝试使用梨邮件.

How can I send mail via smtp using ssl? We are able to send the simple text mail, but it's not allowing the links or certain tags in the mail to pass, we tried using pear-mail.

请提出任何选项.

我们使用第三方 GMAIL,托管在 Godaddy 中.所有 mx 记录都很好,而且早些时候我们可以在没有使用 ssl 的情况下发送邮件,正如我提到的,我们可以使用 ssl 发送简单的文本邮件,所以请不要回答有关托管的问题,只需提供如何使用它的任何选项使用 ssl.

We are using third party GMAIL and hosting is in Godaddy. All mx record are fine and earlier we were able to deviver mails when we have not used ssl, also as i mentioned we are able to send the simple text mails with ssl, so please no answers regarding hostings, just any options how to use it with ssl.

你可能想看看 phpmailer.您可以使用 phpmailer 通过 gmail 的 SMTP 服务器 (smtp.gmail.com) 发送外发邮件,并且它可以选择通过 SSL 连接到 SMTP 服务器.phpmailer 的设置非常简单 - 只需将几个 PHP 文件复制到您的服务器即可.请参阅 https://github.com/PHPMailer/PHPMailer.您可以使用上面 github 页面上的简单示例作为样板发送邮件.

You might want to look at phpmailer. You can use phpmailer to send outgoing messages through gmail's SMTP server (smtp.gmail.com), and it has options to connect to the SMTP server by SSL. phpmailer is very simple to setup - just a few PHP files to copy to your server. See https://github.com/PHPMailer/PHPMailer. You can start sending mail using the simple example at the github page above as a boilerplate.