简体   繁体   English

使用最少的第三方服务从PHP发送邮件?

[英]Send mail from PHP with minimum 3rd party services?

Dont ignore if this sounds like a duplicate. 如果这听起来像是重复,请不要忽略。 I went through similar questions here but couldnt resolve my doubts. 我在这里遇到了类似的问题,但无法解决我的疑虑。

Im developing a site in my localhost. 我在我的localhost中开发一个站点。 Its coded in PHP. 它用PHP编码。 I need to send mail to my site's customers from my PHP script. 我需要从我的PHP脚本向我网站的客户发送邮件。 I know we can use gmail smtp server for this. 我知道我们可以使用gmail smtp服务器。 But due to the limit on the mail/day set by google, i prefer not to use them. 但由于谷歌设定的邮件/日限制,我不想使用它们。

But my doubts are: 但我怀疑的是:

  1. Can i do it without gmail's smtp server or anyone else's smtp server? 我可以在没有gmail的smtp服务器或其他任何人的smtp服务器的情况下这样做吗?
  2. What all components would i need to send mails from my localhost as well as from my online webserver? 我需要从本地主机以及在线网络服务器发送邮件的所有组件是什么?
  3. Does all the webservers come pre-configured to enable us to send mail from site? 是否所有网络服务器都预配置为允许我们从网站发送邮件?
  4. What is sendMail, phpMailer, pearMail etc.? 什么是sendMail,phpMailer,pearMail等? I've been advised to use them. 我被建议使用它们。 But what are they? 但他们是什么?

Thanks a lot! 非常感谢!

EDIT: Im using wamp2.2 in my localhost. 编辑:我在我的localhost中使用wamp2.2。

If you use XAMPP, it comes with Mercury Mail. 如果你使用XAMPP,它会附带Mercury Mail。 You can use that to send mails through localhost. 您可以使用它通过localhost发送邮件。

  1. Of course 当然
  2. Setup an own MTA (Mail Transport Agent) like postfix. 设置自己的MTA(邮件传输代理),如postfix。
  3. In my experience the shared hosts usually already offers a mail agent. 根据我的经验,共享主机通常已经提供了邮件代理。 If you really mean "webserver", than no: A webserver is a webserver. 如果你的意思是“网络服务器”,而不是:网络服务器是一个网络服务器。 Preconfigured packages like XAMPP usually also comes with a MTA. 像XAMPP这样的预配置软件包通常还附带一个MTA。
  4. Libraries to send mail. 图书馆发送邮件。 sendMail could be sendmail , which is itself a MTA-interface. sendMail可以是sendmail ,它本身就是一个MTA接口。

to send email from php , simply use php's own mail function : 从php发送电子邮件,只需使用php自己的邮件功能:

 <?php

             $to = "destinationemailid";

             $subject = "mail subject";

             $message = "your message to send";

             $from =  "sourceemailid";

             $headers = "From:" . $from;

             mail($to,$subject,$message,$headers);



        ?>

this works with xampp on localhost 这适用于localhost上的xampp

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

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