PHP send email, how to deal with

Source: Internet
Author: User
Tags php send email
PHP Send Email
Recently learning how to send email with PHP There are a few questions to ask you for leave
1. How do I set up an email if I want to send it via this computer?
2. If you use virtual space, how can you determine which space you use to send email in PHP?
3. How do I send mail in PHP after I have determined that I have sent an email?
100 points for advice, to detail ah, thank you!

------Solution--------------------
1. How do I set up an email if I want to send it via this computer?
You need to install an MTA such as Sendmail,postfix on this machine, if you do not have a socket to call your own mailbox 163,sohu,sina, or the like, the specific Google php SMTP class or Phpmailer.
2. If you use virtual space, how can you determine which space you use to send email in PHP?
Use the mail () function directly to send yourself a message test and you'll know.
3. How do I send mail in PHP after I have determined that I have sent an email?
Mail ("[email protected]", "title", "Body") can also be seen here in more detail http://php.chinaunix.net/manual/zh/function.mail.php
------Solution--------------------
Study the
It is said that the mail function must be configured on the server, otherwise it cannot be sent
Send it with a socket, never tried.
------Solution--------------------
Mail () function support is not much, the big post office is not already filtered out, not recognized, not the famous mail server sent the letter, to avoid too much junk mail,
PHP with a socket to connect to a mail server, you can use that mail server, to send letters, like the simulation OE and other mail software: sent a command to each other, I want to write, my letter is ... The previous call NetEase can also
1. First to register good one NetEase's mailbox, then will use the user name/password, because he wants to authenticate only his users can call him. And NetEase's SMTP server IP, the port is generally 25, using the mail software This is generally set to
2. Then find a PHP socket letter class, directly in Baidu Search bar
------Solution--------------------
Phpmail This class, you don't have to reinvent the wheel.

Go up to sf.net and search.
------Solution--------------------
The best test to throw on the server directly ...

------Solution--------------------
Call Method:
PHP code
 $smtp _host = ' mail.163.com ';  Sending server $smtp_user = [email protected] ';  For the letter Authentication email$smtp_pass = ' * * * ';  For the letter authentication password$smtp_port =; $mail _format = ' HTML '; Or TXT, the format of the letter $receiver = [email protected] '; $body = ' mail content '; $sm = new SMTP ($SMTP _host, $smtp _user, $smtp _pas S, $smtp _user, $smtp _port); if ($sm->sendmail ($smtp _user, $receiver, ' Registration Validating ', $body, $mail _format)    {echo ' Failed to send email. '; Exit;} 
------Solution--------------------
Top!!! Test it!

Thank 15 floor
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.