Jump to content

Recommended Posts

I implemented PHPMailer yesterday as a test for a scenario we are dealing with here at my office.

 

I am attempting to send an email from our SMTP mail server which does not reside on the same machine as the one the script is running from.

 

Here is my code.

require('../phpmailer/class.phpmailer.php');
//require('../phpmailer/class.smtp.php');


    $mail = new PHPMailer();
      $mail->From = "vcadorders@pacesetterglobal.com";
      $mail->FromName = "VCAD Orders";
      $mail->Host = "smtp.server.com"; //changed for post
      $mail->SMTPAuth = true;
      $mail->Username = "uname"; //changed for post
      $mail->Password = "password"; //changed for post
      
      $mail->Subject = "test";
      //$mail->Body = "See attched file for shipment records for test";
      $mail->AddAddress("chris@severndigital.com");
      //$mail->AddAttachment("$emailstring");
      
if(!$mail->Send()){
      echo "There was and error sedning this message";
      echo '<BR>Mailer error: ' . $mail->ErrorInfo;
      }else{
      echo "Mail was sent successfully.";
      }

When I run this script it returns the mail sent successfully message.

 

When I receive the mail however the headers indicate that the message was sent from the localhost and not the smtp server. See below

Return-Path: <apache@rberry.localhost>
X-Spam-Delete: 12
X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on 
      pacesetter1.inetu.net
X-Spam-Level: **
X-Spam-Status: No, score=2.6 required=8.0 tests=NO_DNS_FOR_FROM,
      UNPARSEABLE_RELAY autolearn=disabled version=3.1.4
Delivered-To: severndigital.com-chris@severndigital.com
Received: (qmail 30583 invoked by uid 89); 16 Oct 2007 20:21:26 -0000
Received: by simscan 1.1.0 ppid: 30579, pid: 30580, t: 0.1366s
         scanners: attach: 1.1.0 clamav: 0.88.3/m:39/d:1639
Received: from unknown (HELO rberry.localhost) (216.64.69.2)
  by pacesetter1.inetu.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 16 Oct 2007 20:21:25 -0000
Received: from rberry.localhost (rberry.localhost [127.0.0.1])
      by rberry.localhost (8.13.8/8.13. with ESMTP id l9GKLOiI029955;
      Tue, 16 Oct 2007 16:21:24 -0400
Received: (from apache@localhost)
      by rberry.localhost (8.13.8/8.13.8/Submit) id l9GKLNra029954;
      Tue, 16 Oct 2007 16:21:23 -0400
To: chris@severndigtial.com
Subject: test
Date: Tue, 16 Oct 2007 16:21:23 -0400
From: VCAD Orders <vcadorders@pacesetterglobal.com>
Message-ID: <3717e3f465ef9a477caaa2f8d06f3114@localhost>
X-Priority: 3
X-Mailer: PHPMailer [version 1.73]
MIME-Version: 1.0
Content-Type: multipart/mixed;
      boundary="b1_3717e3f465ef9a477caaa2f8d06f3114"

 

As you can see the return-path is from the localhost and not our smtp server.

 

Any ideas what I am doing wrong??

 

Thanks in advance,

Chris

 

i would try that too

 

$mail->IsSMTP(TRUE);

 

but i dont think that anything will change...

 

check php mailers website for more help phpmailer.sourceforge.net/

 

 

that didn't so anything .. it just blanked my script. I turned on PHP error reporting and still nothing

 

I've been on the php mailer website for 2 days. I am using the example straight from the main page of the site, and it still doesn't work.

 

**** EDIT ****

 

Your fix did work however the syntax is

 

$mail->IsSMTP();

 

thanks,

Chris

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.