SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to setup mailing in PHP???

    I'm not sure what I'm doing wrong, but I can't get phpMailer to send an email form my computer through my isp's smtp server. I keep getting the following error message

    Code:
    Message was not sentMailer Error: Language string failed to load: recipients_failed xxxxxxx@gmail.com
    I have set my php.ini settings as follows:

    ; For Win32 only.
    SMTP = smtp.telus.net
    smtp_port = 25
    sendmail_from = testing@localhost.com

    The SMTP server address is right, I'm not sure about the sendmail_from option.

    The mailing script I am using:

    Code:
    <?php
    require("phpmailer/class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host = "smtp.telus.net"; // SMTP server
    $mail->SMTPAuth = false;     // turn on SMTP authentication
    
    $mail->FromName = "Billy";	// Sets the name of the emailer
    $mail->From = "somebody@hotmail.com";  // Sets the email address of the sender
    $mail->AddAddress("xxxxxx@gmail.com");  // Sets the To Address
    $mail->Subject = "testing email";	// Sets the subject heading
    $mail->Body = "This is a test";
    $mail->WordWrap = 50;
    
    
    if(!$mail->Send())
    {
       echo "Message was not sent";
       echo "Mailer Error: " . $mail->ErrorInfo;
    }
    else
    {
       echo "Message has been sent!";
    }
    ?>

    Thanks

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since you have already configured in your php.ini, you don't have to specify here in phpmailer again. I am saying so that i have already used the PHPMailer class to send the emails and works me fine without using following three lines:
    PHP Code:
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host "smtp.telus.net"// SMTP server
    $mail->SMTPAuth false;     // turn on SMTP authentication 
    But I am not sure whether they overwrites the php.ini configurations.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did the trick, thanks Something simple like sending an email can be a nightmare...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •