doutui4649 2014-02-05 15:43
浏览 127
已采纳

从localhost发送电子邮件?

im kinda stuck, i have read some threads where they use google smtp to send mails from localhost. Im using xampp right now and im trying to use google smtp but it doesn't work what have i done wrong ?

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\page.php on line 48

My Code in php.ini:

sendmail_from = T***@gmail.com
Gmail SMTP server address: smtp.gmail.com
Gmail SMTP user name: T***@gmail.com
Gmail SMTP password: ****
Gmail SMTP port: 465
Gmail SMTP TLS/SSL required: yes
  • 写回答

1条回答 默认 最新

  • donglei7152 2014-02-05 15:54
    关注

    You have to set the SMTP-Server, Port and authentication credentials in your php.ini.

    But for this it's much easier to use the wonderful PHPMailer class.

    It's very easy to implement and to use.

    You can easily send complex emails (HTML, Attachments) and it has a good support for external SMTP server, including e.g. encryption.

    Just take a look at the examples in the "examples" folder or scroll down at the linked page where is an example using SMTP auth in the first code-block.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 SPSS分类模型实训题步骤
  • ¥15 求解决扩散模型代码问题
  • ¥15 工创大赛太阳能电动车项目零基础要学什么
  • ¥20 limma多组间分析最终p值只有一个
  • ¥15 nopCommerce开发问题
  • ¥15 torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGKILL
  • ¥15 QuartusⅡ15.0编译项目后,output_files中的.jdi、.sld、.sof不更新怎么解决
  • ¥15 pycharm输出和导师的一样,但是标红
  • ¥15 想问问富文本拿到的html怎么转成docx的
  • ¥15 我看了您的文章,遇到了个问题。