简体   繁体   English

从xampp发送电子邮件? 水银邮件服务器? 中继邮件服务器?

[英]send email from xampp? mercury mail server? relay mail server?

I have been researching this topic as i have been having some difficulties send email using my php script. 我一直在研究这个主题,因为我在使用php脚本发送电子邮件时遇到了一些困难。 When i execute my contactform.php it executes send_form_email.php and that basically says the email has been sent. 当我执行我的contactform.php文件时,它会执行send_form_email.php文件,这基本上表示电子邮件已发送。 There is nothing wrong with my scripts since i had a friend that is code test it on his server he was able to submit the form and generate an email. 我的脚本没有错,因为我有一个朋友正在他的服务器上对其进行代码测试,因此他能够提交表单并生成电子邮件。

So now i went through the steps of configuring the sendmail.ini and the php.ini i believe i am configuring it right according to online tutorials. 因此,现在我完成了配置sendmail.ini和php.ini的步骤,我相信我根据在线教程进行了正确配置。 I have also tested this on my aws server which is on the internet and has disabled the firewall so all ports are open and still unable to send the email through my php scripts. 我还在互联网上的AWS服务器上测试了此功能,该服务器已禁用了防火墙,因此所有端口均处于打开状态,并且仍然无法通过php脚本发送电子邮件。 I will post the example of what i am using to configure my .ini files. 我将发布用于配置.ini文件的示例。

So now i am left with creating an mail server. 因此,现在我要创建一个邮件服务器。 Not too sure of what my options are. 不太确定我的选择是什么。 I was thinking a relay mail server that would take on the work load and i would not need to go through the hassle of deploying a mail server. 我当时在考虑中继邮件服务器,它将承担工作量,而我无需经历部署邮件服务器的麻烦。 Then i have Mercury on the xampp to configure but cannot find a decent tutorial out there that can help me. 然后我在xampp上配置了Mercury,但是找不到一个可以帮助我的体面的教程。 So i am here asking for professional advice how should i tackle this issue. 所以我在这里寻求专业建议,我应该如何解决这个问题。 In my gmail i have enabled everything so all traffic using pop3, imap, and smtp can send and receive just not too sure what i can do. 在我的gmail中,我启用了所有功能,因此使用pop3,imap和smtp的所有流量都可以发送和接收,只是不太确定我能做什么。 I have never deployed an email server so i am looking for something very easy to use. 我从未部署过电子邮件服务器,因此我正在寻找易于使用的东西。 This is for a small project that i am going to end up doing away with. 这是一个小项目,我最终将放弃。

  https://shellcreeper.com/enable-send-email-in-xampp/

  php.ini from:

  [mail function]
    ; For Win32 only.
    ; http://php.net/smtp
    SMTP = localhost
    ; http://php.net/smtp-port
    smtp_port = 25

    ; For Win32 only.
    ; http://php.net/sendmail-from
    ;sendmail_from = postmaster@localhost

    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    ; http://php.net/sendmail-path
    ;sendmail_path = "\"\XAMPP\sendmail\sendmail.exe\" -t"


  To:

  [mail function]
    ; For Win32 only.
    ; http://php.net/smtp
    SMTP = smtp.gmail.com
    ; http://php.net/smtp-port
    smtp_port = 587

    ; For Win32 only.
    ; http://php.net/sendmail-from
    sendmail_from = {your gmail username}@gmail.com

    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    ; http://php.net/sendmail-path
    sendmail_path = "\"\XAMPP\sendmail\sendmail.exe\" -t"


   Sendmail.ini

   from:

    smtp_server=localhost
    smtp_port=25

    to:
    ;smtp_server=localhost
    ;smtp_port=25
    and add this in the bottom of your sendmail,ini:

    ;new config:
    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=tls
    error_logfile=error.log
    pop3_server=
    pop3_username=
    pop3_password=
    force_recipient=
    hostname=

    auth_username={your gmail username}@gmail.com
    auth_password={your gmail password}
    force_sender={your gmail username}@gmail.com

You could try an SMTP for the time being and use Google mail to send emails.... Here's information on setting it up: 您可以暂时尝试使用SMTP,然后使用Google邮件发送电子邮件。...以下是有关设置的信息:

  1. SMTP server (ie, outgoing mail): smtp.gmail.com SMTP服务器(即外发邮件):smtp.gmail.com

  2. SMTP username: Your full Gmail or Google Apps email address (eg example@gmail.com or example@yourdomain.com) SMTP用户名:您的完整Gmail或Google Apps电子邮件地址(例如example@gmail.com或example@yourdomain.com)

  3. SMTP password: Your Gmail or Google Apps email password SMTP密码:您的Gmail或Google Apps电子邮件密码

  4. SMTP port: 465 SMTP端口:465

  5. SMTP TLS/SSL required: yes 需要SMTP TLS / SSL:是

In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and: Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder. 为了将外发电子邮件的副本存储在Gmail或Google Apps已发送文件夹中,请登录Gmail或Google Apps电子邮件设置,然后:单击转发/ IMAP选项卡并向下滚动到IMAP访问部分:必须在以下位置启用IMAP:为了将电子邮件正确复制到您的已发送文件夹中。

https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM