SMTPSetting with code example problem statement

Once you've installed phpList... ask questions here!
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation.

SMTPSetting with code example problem statement

Postby SBSimpsonite » 7:50pm, Mon 03 Nov, 2014

I've set up my phpList install behind a firewall and I am filtering my mail through my smtp server with is on a windows server 2008 r2.
Problem: Having a heck of a time getting the mail to transfer using the smtp configuration.

What was done: downloaded phpmailer and created a stand alone test via the phpmailer class

**************************************************************************
this code works with setting details obscured
**************************************************************************
Code: Select all
 <html>
<head>
<title>PHPMailer - SMTP advanced test with authentication</title>
</head>
<body>
<?php
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP
try {
  $mail->Host       = "192.168.X.X"; // SMTP server
// $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
  $mail->SMTPAuth   = true;                  // enable SMTP authentication
 
  $mail->Port       = 25;                    // set the SMTP port for the GMAIL server
  $mail->Username   = "user@domain.local"; // SMTP account username
  $mail->Password   = "correcTpASS";        // SMTP account password
  $mail->AddAddress('add1@usersdomain.com', 'John Doe');
  $mail->SetFrom('email@fromsite.com', 'First Last');
  $mail->AddReplyTo('destination@destemail.com', 'First Last');
  $mail->Subject = 'PHPMailer Test Subject via mail(), advanced works';
  $mail->MsgHTML(file_get_contents('contents.html'));
  $mail->Send();
  echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
  echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
  echo $e->getMessage(); //Boring error messages from anything else!
}
?>

</body>
</html>

***********************************************************************************
end working code
***********************************************************************************

Problem continued: I've set up the smtp setting to mirror this code block in the config.php, however the mail fails. Now before someone jumps and says your IP is wrong or the username should be user@domain.com (etc.. rather than) user@domian.local I will assure you that this is correct and its not a typo. These setting in the working script function because they sit behind a firewall and we're referencing the domain locally. I've also set the SMTPDebug method to "2" to see the output. this is what I get with a successful transfer via my script.

*************************************************************************************
output begins
*************************************************************************************

SMTP -> FROM SERVER:220 SBS-MAIL01.domain.local Microsoft ESMTP MAIL Service ready at Mon, 3 Nov 2014 14:40:02 -0500
SMTP -> FROM SERVER: 250-SBS-MAIL01.domain.local Hello [10.0.2.50] 250-SIZE 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-X-ANONYMOUSTLS 250-AUTH NTLM LOGIN 250-X-EXPS GSSAPI NTLM 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250-XEXCH50 250 XRDST
SMTP -> FROM SERVER:250 2.1.0 Sender OK
SMTP -> FROM SERVER:250 2.1.5 Recipient OK
SMTP -> FROM SERVER:354 Start mail input; end with .
SMTP -> FROM SERVER:250 2.6.0 Queued mail for delivery
SMTP -> FROM SERVER:221 2.0.0 Service closing transmission channel
Message Sent OK

*****************************************************************************************
end debug
*****************************************************************************************

The machine actually resides at 10.0.2.50

Cheers and many thanks
SBSimpsonite
phpList newbie
 
Posts: 1
Joined: 7:24pm, Mon 03 Nov, 2014

Re: SMTPSetting with code example problem statement

Postby Dawidosza » 12:04pm, Fri 14 Nov, 2014

Had very similiar problem :/
Dawidosza
phpList newbie
 
Posts: 1
Joined: 12:03pm, Fri 14 Nov, 2014

Re: SMTPSetting with code example problem statement

Postby Dragonrider » 1:34pm, Fri 14 Nov, 2014

Dawidosza wrote:Had very similar problem :/


Please start your own topic, and give details of what you have done, your version of phpList.
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom


Return to Questions and Problems after Installing

Who is online

Users browsing this forum: No registered users and 5 guests