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 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?