I am just learning php and it's my first question on this site. Hope, you will help me. I just want to send Email from my local machine to gmail. I have tried but didn't got any success. Please help How to do this. my code is form processing return mail( $message['to'], join(" ", $headers)) }; ?>
3条回答 默认 最新
- duanmeng1950 2010-11-16 12:21关注
You will want the
mail()
function see: php.net/manual/en/function.mail.phpmail('kushagra@gmail.com', 'My First Email', 'The body of my email');
You will need a mail server running on your local machine such as Postfix for *nix or Pegasus for Windows.
If you do not have the ability run a mail server on your machine then you might need to use a PHP class that allows you to connect to an SMTP server such as SwiftMailer or PHPMailer.
Be aware though that a lot of ISPs will block connections on port 25 (SMTP) to protect against spamming (see my encounter of this with Optus a few years ago http://blog.simonholywell.com/post/374223466/optus-cable-port-25-smtp). If they are blocking it then you will need to use their SMTP server.
There is a tool linked in my blog post above which will allow you to determine if it is blocked or not see: http://www.zoneedit.com/smtp.html
解决 无用评论 打赏 举报
悬赏问题
- ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
- ¥15 Vue3地图和异步函数使用
- ¥15 C++ yoloV5改写遇到的问题
- ¥20 win11修改中文用户名路径
- ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
- ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
- ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
- ¥15 帮我写一个c++工程
- ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
- ¥15 关于smbclient 库的使用