Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Send mail error
    primarykey
    data
    text
    <p>Please help me I am New in PHP and since last 5 Hours i am try to semd mail and now really tired. Thanks.</p> <p><strong>Here is my code. I am using Gmail account.</strong> <pre><code>include("class.phpmailer.php"); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); $body = $mail-&gt;getFile('contents.html'); $body = eregi_replace("[\]",'',$body); $mail-&gt;IsSMTP(); $mail-&gt;SMTPAuth = true; // enable SMTP authentication $mail-&gt;SMTPSecure = "ssl"; // sets the prefix to the servier $mail-&gt;Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail-&gt;Port = 465; // set the SMTP port for the GMAIL server $mail-&gt;Username = "hussaintalha@gmail.com"; // GMAIL username $mail-&gt;Password = "xxxxxxxx"; // GMAIL password $mail-&gt;AddReplyTo("hussaintalha@gmail.com","First Last"); $mail-&gt;From = "hussaintalha@gmail.com.com"; $mail-&gt;FromName = "First Last"; $mail-&gt;Subject = "PHPMailer Test Subject via gmail"; //$mail-&gt;Body = "Hi,&lt;br&gt;This is the HTML BODY&lt;br&gt;"; //HTML Body $mail-&gt;AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail-&gt;WordWrap = 50; // set word wrap $mail-&gt;MsgHTML($body); $mail-&gt;AddAddress("hussaintalha@gmail.com", "John Doe"); $mail-&gt;AddAttachment("images/phpmailer.gif"); // attachment $mail-&gt;IsHTML(true); // send as HTML if(!$mail-&gt;Send()) { echo "Mailer Error: " . $mail-&gt;ErrorInfo; } else { echo "Message sent!"; } ?&gt; </code></pre> <p>When I run my file I get This Error:</p> <blockquote> <p>Warning: fopen(contents.html) [function.fopen]: failed to open stream: No such file or directory in D:\xampplite\htdocs\WebEng\class.phpmailer.php on line 1870</p> <p>Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in D:\xampplite\htdocs\WebEng\class.smtp.php on line 122 Mailer Error: SMTP Error: Could not connect to SMTP host.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload