Email doesn't send using phpmailer class via SMTP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vivekgs2007
    New Member
    • Mar 2010
    • 62

    #1

    Email doesn't send using phpmailer class via SMTP

    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..
    Code:
    require_once('class.phpmailer.php');
    //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
    $mail_date = date("d-m-Y");
    $body             = file_get_contents('contents.html');
    $body             = eregi_replace("[\]",'',$body);
    $mail             = new PHPMailer(); // defaults to using php "mail()"
    
    
    
    
    
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->SMTPSecure = "ssl";   
    $mail->Host       = "smtp.bizmail.yahoo.com";  // sets GMAIL as the SMTP server
    $mail->Port       = 465;  
    $mail->Username = "username"; 
    $mail->Password = "password"; 
    
    
    $mail->IsHTML(true);	
    
    $mail->SetFrom($Email, $Name);
    
    
    
    $address = "swd@eitech.in";
    $mail->AddAddress($address, "vivek");
    
    $mail->Subject    = "PHPMailer Test Subject via mail(), basic";
    
    //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
    
    $mail->MsgHTML($body);
    
    
    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/>";
    If not check it in this link..
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    Try adding this after line #6:
    [code=php]
    $mail->IsSMTP();
    $mail->SMTPDebug = 2;[/code]

    And make sure you have the error messages turned on.

    Comment

    • vivekgs2007
      New Member
      • Mar 2010
      • 62

      #3
      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..

      Comment

      • vivekgs2007
        New Member
        • Mar 2010
        • 62

        #4
        Hi Atil,
        Finally i got the answer the problem is

        Code:
        mail($to,$subject,$message);
        I used this
        Code:
        mail($to,$subject,$message, $headers);
        Thank you for concerning me...I will be great full to you...

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          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:
          [code=php]$mail->Send()[/code]

          Comment

          • vivekgs2007
            New Member
            • Mar 2010
            • 62

            #6
            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(INTRANE T)...I don't no how to do this..Please can u give me some suggestion to me...

            Comment

            Working...