By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,452 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,452 IT Pros & Developers. It's quick & easy.

Email doesn't send using phpmailer class via SMTP

vivekgs2007
P: 60
HI to all,
I downloaded the Php Mailer Function, I embedded it to my Feedback page, It is not giving any error, But the mail is not going, I don't no where i gone wrong...Please help me in this..
Expand|Select|Wrap|Line Numbers
  1. require_once('class.phpmailer.php');
  2. //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
  3. $mail_date = date("d-m-Y");
  4. $body             = file_get_contents('contents.html');
  5. $body             = eregi_replace("[\]",'',$body);
  6. $mail             = new PHPMailer(); // defaults to using php "mail()"
  7.  
  8.  
  9.  
  10.  
  11.  
  12. $mail->SMTPAuth   = true;                  // enable SMTP authentication
  13. $mail->SMTPSecure = "ssl";   
  14. $mail->Host       = "smtp.bizmail.yahoo.com";  // sets GMAIL as the SMTP server
  15. $mail->Port       = 465;  
  16. $mail->Username = "username"; 
  17. $mail->Password = "password"; 
  18.  
  19.  
  20. $mail->IsHTML(true);    
  21.  
  22. $mail->SetFrom($Email, $Name);
  23.  
  24.  
  25.  
  26. $address = "swd@eitech.in";
  27. $mail->AddAddress($address, "vivek");
  28.  
  29. $mail->Subject    = "PHPMailer Test Subject via mail(), basic";
  30.  
  31. //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  32.  
  33. $mail->MsgHTML($body);
  34.  
  35.  
  36. echo "<br/><center><style='font-size:1.2em;color:#0557A9;'>Thank You For Sending The Feedback To Us,<br/>We Will Get Back To You With A solution To Your Query.</center><br/>";
  37.  
If not check it in this link..
http://www.eitech.in/prj_feedback.php
Apr 1 '10 #1
Share this Question
Share on Google+
5 Replies


Atli
Expert 5K+
P: 5,058
Hey.

Try adding this after line #6:
Expand|Select|Wrap|Line Numbers
  1. $mail->IsSMTP();
  2. $mail->SMTPDebug  = 2;
And make sure you have the error messages turned on.
Apr 1 '10 #2

vivekgs2007
P: 60
I added that one, but the mail is not coming,is that any thing change have to be done in php mailer function..
once u check it by giving the feedback..
http://www.eitech.in/prj_feedback.php
Apr 1 '10 #3

vivekgs2007
P: 60
Hi Atil,
Finally i got the answer the problem is

Expand|Select|Wrap|Line Numbers
  1. mail($to,$subject,$message);
  2.  
I used this
Expand|Select|Wrap|Line Numbers
  1. mail($to,$subject,$message, $headers);
  2.  
Thank you for concerning me...I will be great full to you...
Apr 2 '10 #4

Atli
Expert 5K+
P: 5,058
Note that the mail() function is not a part of PHPMailer, so if you use it you can remove the PHPMailer include and all of the PHPMailer code.

Using PHPMailer, you send the mail by doing:
Expand|Select|Wrap|Line Numbers
  1. $mail->Send()
Apr 2 '10 #5

vivekgs2007
P: 60
ya i removed all the code of php mailer...only mail() i used...now its working perfectly...now i am moving to new project...
Its based on the COMPANY INTERNAL WEBSITE(INTRANET)...I don't no how to do this..Please can u give me some suggestion to me...
Apr 2 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.