I know we can send email from php using smtp servers on different hosts or if there is local smtp server installed. What I want to know is can php send email without any local or remote smtp servers? I have heard about sendmail program but can it function without any mail server installed in the server?
相关问题
- Django & Amazon SES SMTP. Cannot send email
- How to add sender name before sender address in py
- TCL Email Script doesn't deliver in Activestat
- Is the SMTP virtual server deprecated in IIS 7?
- error while sending mail using javamail
相关文章
- c#发送邮件,附件损坏
- com.sun.mail.smtp.SMTPSenderFailedException: 550 5
- Outlook SMTPClient server error 5.3.4 5.2.0
-
553 5.7.1
: Sender address rejected: not - Send email from my custom mailgun SMTP address
- Sending email using xampp localhost
- SmtpClient in C# using smtp.Gmail.com:857 with Goo
- SMTP client Java program
At some point you have to talk to a SMTP server. Sending via a SMTP server on the local host is the cleanest option and the most likely to succeed at getting through spam filters.
What a mail server does is quite complex. Let's take your average e-mail as it arrives from your e-mail client to your e-mail server with an outbound host as the destination:
The next e-mail server in the queue then repeats the above until the final server receives the e-mail and sits in the recipient's mailbox.
Doing that within PHP is possible, but I don't recommend it. MX record lookup can be tricky because people do all sorts of non-compliant things that mail servers tolerate. Plus, your script might time out while attempting to connect directly to the target SMTP server. Some servers are also configured to "greylist" e-mail, which means the e-mail will initially be rejected but would be accepted later (e.g. 30 minutes is not unusual). The average PHP script won't be able to handle that scenario.