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