If you have any questions about sending emails, please

Source: Internet
Author: User
If you have sent an email, please contact us! First: $ to & quot; luoing_2@163.com & quot; $ subject & quot; Testmail & quot; $ message & quot; Hello! Thisisasimpleemailmessage. & quot; $ from & quot; luoin_2@126.com & email problems, have done please!
First:
$ To = "luoing_2@163.com ";
$ Subject = "Test mail ";
$ Message = "Hello! This is a simple email message .";
$ From = "luoin_2@126.com ";
$ Headers = "From: $ from ";
Mail ($ to, $ subject, $ message, $ headers );
Echo "Mail Sent .";

==========================================
Second


Require 'class. phpmailer. php ';

Try {
$ Mail = new PHPMailer (true); // New instance, with exceptions enabled

$ Body = file_get_contents('contents.html ');
$ Body = preg_replace ('// \\\/', '', $ body); // Strip backslashes

$ Mail-> IsSMTP (); // tell the class to use SMTP
$ Mail-> SMTPAuth = true; // enable SMTP authentication
$ Mail-> Port = 25; // set the SMTP server port
$ Mail-> Host = "smtp.126.com"; // SMTP server
$ Mail-> Username = "luoin_2@126.com"; // SMTP server username
$ Mail-> Password = "luo11111"; // SMTP server password

$ Mail-> IsSendmail (); // tell the class to use Sendmail

$ Mail-> AddReplyTo ("name@domain.com", "First Last ");

$ Mail-> From = "luoin_2@126.com ";
$ Mail-> FromName = "Biyi Network ";

$ To = "wang_lin_1@163.com ";

$ Mail-> AddAddress ($ );

$ Mail-> Subject = "First PHPMailer Message ";

$ Mail-> AltBody = "To view the message, please use an HTML compatible email viewer! "; // Optional, comment out and test
$ Mail-> WordWrap = 80; // set word wrap

$ Mail-> MsgHTML ($ body );

$ Mail-> IsHTML (true); // send as HTML

If (! $ Mail-> Send ())
{
Echo "Message cocould not be sent.

";
Echo "Mailer Error:". $ mail-> ErrorInfo;
Exit ();
} Else {
Echo "Message has been sent ";
}
} Catch (phpmailerException $ e ){
Echo $ e-> errorMessage ();
}

After sendmail is started, what emails are sent in spam?

========================================================== ==================================


------ Solution --------------------
After sendmail is successful, you must use the receiving program to receive it. qmail is on my machine, and you do not know it.
------ Solution --------------------
After sendmail is started, what emails are sent in spam?

It may be because the email receiving mailbox has Related filtering settings.
It may be defined by the user, or the mailbox is defined by default.
. The result is: when a type of mail or a user's mail
After the email is sent to the target email address, the target email address automatically identifies it as spam,
And delete it or put it in the recycle bin.
Spam,
------ Solution --------------------
First, it is certainly not good. your own sendmail as an smtp server will not be trusted by other email servers. using 126 for smtp is certainly not easy to be considered as spam.
------ Solution --------------------
$ Mail-> IsSendmail (); // tell the class to use Sendmail

Remove this sentence.
------ Solution --------------------
Spam cannot be controlled
------ Solution --------------------
Change IP address

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.