I am trying to send an email using PHP mailer. There is nothing in the web browser that I get is a white screen. I have used different instances of code changed to SSL, for 583 to 465, TLS port requires autoload.php phpmailer.php smtp.php, I can get an indication that the problem is where the code E-mail credentials and so on. Any ideas that you may have or if you are looking for something that I would appreciate.
& lt ;? Php $ account = "xxxxxxxxx@gmail.com"; $ Password = 'xxxxxx'; From $ '= Xxxxxxxx@gmail.com'; $ From_name = 'Adam Johnson'; $ Theme = 'test'; $ Msg = 'This is a test'; $ From = "xxxxxxxxx@hotmail.com"; Required ('/ PHHPMailer / class.phpmailer.php'); $ Mail- & gt; SMTPDebug = 3; $ Mail = new PHPMailer (); $ Mail & gt; IsSMTP (); $ Mail- & gt; Charset = 'utf-8'; $ Mail- & gt; Host = 'smtp.gmail.com'; $ Mail- & gt; SMTPAuth = true; $ Mail- & gt; Port = 587; $ Mail- & gt; User name = $ account; $ Mail- & gt; Password = $ password; $ Mail- & gt; SMTPSecure = 'Tls'; $ Mail- & gt; From = $ to; $ Mail- & gt; Sainam = $ from_name; $ Mail & gt; IsHTML (true); $ Mail- & gt; Subject = $ theme; $ Mail- & gt; Body = $ msg; $ Mail & gt; AddAddress (for $); If (! Mail-> Send ()) {echo 'mailer error:'. $ Mail & gt; ErrorInfo; } Else {echo 'Message sent!'; }? & Gt;
this requires
('/ PHPMailer / class.phpmailer.php '); $ Mail- & gt; SMTPDebug = 3; $ Mail = new PHPMailer ();
should look like this;
is required ('/PHPMailer/class.phpmailer.php'); $ Mail = new PHPMailer (); $ Mail- & gt; SMTPDebug = 3; You have not initiated the $ mail
variable in your code yet, you can still use $ mail-> Trying to set SMTPDebug = 3;
on a non-existent object
Edit
Another typo line in the code if (! Mail-> Send ()) { Code> $
is a variable declaration Make sure it reads (! $ Mail- & gt; send ()) {
No comments:
Post a Comment