How does the mail server build?

Source: Internet
Author: User
Tags mx record
Title? There is also a question, why the Linux Mail can be sent directly mail? If it's straightforward, which PHP sends the shell command directly when sending mail, why do you want the mail server?

Reply content:

Title? There is also a question, why the Linux Mail can be sent directly mail? If it's straightforward, which PHP sends the shell command directly when sending mail, why do you want the mail server?

Simple messages, such as server alarms, can really do that.
But not every server is loaded with SendMail, and in order to pass anti-spam software, you may need to add the email address to a variety of white lists.
There is so much to know at the moment, without further research.

Not all servers have PHP execute shell commands.

No, as if that is the PHP mail function, and the local does not necessarily need mail server, I used to change the configuration file, so that mail directly to the Gmail, just to write the user name and password in the configuration file.
The built-in mail function is simple to use, but only if the default mail server is configured in php.ini.


  
   

See: http://php.net/manual/en/function.mail.php

As if you can also directly in the program with the SMTP class to initialize their own instance to connect the server, of course, this server can be local 25, or it can be outside.

$smtpserver = "smtp.126.com";//SMTP服务器$smtpserverport =25;//SMTP服务器端口$smtpusermail = "xxxxxx@126.com";//SMTP服务器的用户邮箱$smtpemailto = $tempsendmail;//发送给谁$smtpuser = "xxxxxx@126.com";//SMTP服务器的用户帐号$smtppass = "******";//SMTP服务器的用户密码$mailsubject = "取回密码";//邮件主题$mailbody = $username."您好!";//邮件内容$mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.//$smtp->debug = TRUE;//是否显示发送的调试信息$send=$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);    

Invoking the shell with CGI is also a function of sending mail to PHP, which is itself a protocol that can communicate as long as the protocol is followed. But the General mail agent will do a processing of advertising mail, such as to check whether the sending address and user name has been, the domain name is common, the most important thing is to be able to see the domain corresponding to the MX record. Otherwise, your mail will be blocked by most of the advertising mail or more serious will cause the return of the letter, as you say the use of mail command to send an email, the essence is to use sendmail for sending, but also an old mail client, not you say directly using the Mail command to send, You can try uninstalling out SendMail will find mail error

  • Related Article

    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.