Use the Phpmailer class to do the Send mail function, prompt 500 error?

Source: Internet
Author: User
Tags server error log
I use the Phpmailer class to do the Send mail function, prompting 500 error internal Server error;
Call code should be no problem, connect to the online instance write,
Do you need any other steps or configurations before you can send the message?


Reply to discussion (solution)

A 500 error indicates a problem with your code!
Open the error display function of PHP, debugging

Internal Server Error
The server encountered an internal error or misconfiguration and is unable to complete your request.

Please contact the server administrator, admin@example.com and inform them of the time the error occurred, and anything yo U might has done so may has caused the error.

More information on this error available is in the server error log

A run on the direct hint of this, and did not report anything wrong.

Require ("./class.phpmailer.php"); $mail = new Phpmailer (); $mail->issmtp ();//Enable smtp$mail->host = "smtp.sina.cn" ;//SMTP Server $mail->smtpauth = true;//turn on SMTP authentication $mail->username = "Fgrhda";//SMTP user name $mail->password = "123456"; /smtp Password $mail->from = "fgrhda@163.com";//Sender Address $mail->fromname = "Mailer";//Sender $mail->addaddress ("97235694@ Qq.com "," Josh Adams ");//Add recipient//$mail->addaddress (" ellen@example.com "), $mail->addreplyto (" 97235694@qq.com " , "information");//reply Address $mail->wordwrap = 50;//Set each line character length/** attachment settings $mail->addattachment ("/var/tmp/file.tar.gz"); /Add Attachment $mail->addattachment ("/tmp/image.jpg", "new.jpg");//Add attachment and specify name */$mail->ishtml (TRUE);//Whether HTML-formatted mail $ Mail->subject = "Here is the Subject";//message subject $mail->body = "This is the HTML message BodyIn bold!";//mail Content $mail->altbody =" This is the body in plain text for non-html mail clients ";//The message body does not support HTML alternate display if (! $mail->sen D ()) {echo ' Message could not ' be sent.

"; echo "Mailer Error:". $mail->errorinfo; Exit;} echo "Message has been sent";


This code is like this, according to the instance of the

Prompt two lines of code, do not read understand what meaning

In the php file page header Plus
Date_default_timezone_set ("PRC"); Try.
or set the time zone in php.ini: DATE.TIMEZONE=PRC

  • 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.