473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

PHPMailer Complications

dlite922
1,584 Expert 1GB
I can't seem to get it working with my smtp server.

I can send the email through the command line like so:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Wed, 6 Aug 2008 18:44:29 -0600 
  3. EHLO www.dmconsultingonline.com 250-localhost.localdomain Hello mail.dmconsultingonline.com [x.x.x.x], pleased to meet you 250-ENHANCEDSTATUSCODES 
  4. 250-PIPELINING 
  5. 250-8BITMIME 
  6. 250-SIZE 
  7. 250-DSN 
  8. 250-ETRN 
  9. 250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN 
  10. 250-DELIVERBY 
  11. 250 HELP MAIL 
  12. FROM: dmurad@dmconsultingonline.com 
  13. 250 2.1.0 dmurad@dmconsultingonline.com... Sender ok 
  14. RCPT TO: dmurad@dmconsultingonline.com 
  15. 250 2.1.5 dmurad@dmconsultingonline.com... Recipient ok 
  16. DATA 
  17. 354 Enter mail, end with "." on a line by itself 
  18. THIS IS A TEST email to dmurad 
  19. 250 2.0.0 m770iTb2013039 Message accepted for delivery 
  20. QUIT 
  21. 221 2.0.0 localhost.localdomain closing connection
  22.  
  23.  
the message shows up fine in my outlook inbox.

Note: in outlook I do have to set "My Outgoing server requires authentication"
and it uses the same login as for POP.

I know this makes a difference, but outlook doesn't tell you "technically" what difference that check mark makes.

without this outlook doesn't connect to it.

but, anyway:

PHP Code (this is from example that comes with PHPMailer):

[PHP]

require_once("config.php");

$mail = new PHPMailer();

$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "72.16.128.45"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "dmurad"; // SMTP username
$mail->Password = "connie02"; // SMTP password

$mail->From = "dmurad@dmconsultingonline.com";
$mail->FromName = "Mailer";
$mail->AddAddress("dmurad@dmconsultingonline.com");

$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
echo "<b>Message could not be sent. </b><p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Message has been sent";

[/PHP]

here's the output:

Expand|Select|Wrap|Line Numbers
  1. SMTP -> FROM SERVER: 
  2. SMTP -> FROM SERVER: 
  3. SMTP -> ERROR: EHLO not accepted from server: 
  4. SMTP -> FROM SERVER: 
  5. SMTP -> ERROR: HELO not accepted from server: 
  6. SMTP -> FROM SERVER: 
  7. SMTP -> ERROR: MAIL not accepted from server: 
  8. SMTP -> FROM SERVER: 
  9. SMTP -> ERROR: RSET failed: Message could not be sent.
  10.  
  11. Mailer Error: The following From address failed: dmurad@dmconsultingonline.com
  12.  
I even tried it with SMTPAuth off/false.

any clues?
Aug 7 '08 #1
7 22812
Gulzor
27
Try this :
[php]
$PHPMailer->SMTPAuth = true;
$PHPMailer->SMTPSecure = "ssl";
[/php]

Also, set $PHPMailer->Port with the correct port value if necessary.
Aug 7 '08 #2
dlite922
1,584 Expert 1GB
Try this :
[php]
$PHPMailer->SMTPAuth = true;
$PHPMailer->SMTPSecure = "ssl";
[/php]

Also, set $PHPMailer->Port with the correct port value if necessary.
I've tried that before, here's the output:

Expand|Select|Wrap|Line Numbers
  1. SMTP -> FROM SERVER: 
  2. SMTP -> FROM SERVER:  
  3. SMTP -> ERROR: EHLO not accepted from server:  
  4. SMTP -> FROM SERVER:  
  5. SMTP -> ERROR: HELO not accepted from server:  
  6. NULL 
  7. SMTP -> FROM SERVER: 
  8. SMTP -> ERROR: MAIL not accepted from server:  
  9. SMTP -> FROM SERVER: 
  10. SMTP -> ERROR: RSET failed:  <b>Message could not be sent. </b><p>Mailer Error: The following From address failed: dmurad@dmconsultingonline.com
  11.  
  12.  
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Thu, 7 Aug 2008 01:53:26 -0600
EHLO localhost
250-localhost.localdomain Hello mydomain.com [x.x.x.x], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP
AUTH LOGIN
334 DijfexggbWU6
ZG11cmFk229 UgFzc3c9dmQ6
Y234TymllMDI=235 2.0.0 OK Authenticated
MAIL FROM: myemail@hotmail.com
250 2.1.0 myemail@hotmail.com... Sender ok
RCPT TO: myemail@anotherhost.com
250 2.1.5 myemail@anotherhost.com... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
TESTING COMMAND LINE
.
250 2.0.0 m777rQNh014545 Message accepted for delivery
QUIT
221 2.0.0 localhost.localdomain closing connection


Connection to host lost.

[/code]

I got the email in my inbox just fine.

Because of these complications, I decided to skip PHPMailer go directly to the source: class.smtp.php file it uses and see if I can get that to work.

I'll post my code (i'm stuck there too) shortly...
Aug 7 '08 #3
dlite922
1,584 Expert 1GB
here you go:
Expand|Select|Wrap|Line Numbers
  1. require_once("smtp.php");
  2.  
  3.  
  4. echo "<pre>Start...";
  5. $smtp = new SMTP();
  6. $smtp->do_debug = 5;
  7.  
  8. echo "\n\nConnecting...";
  9. var_dump($smtp->Connect("72.16.128.45","25")); 
  10.  
  11.  
  12. echo "\n\nEhlo...";
  13. $smtp->Hello(); 
  14.  
  15. die();
  16.  
  17.  
output is similar, So i guess if I solve this, i'll get to the root of the problem.



Expand|Select|Wrap|Line Numbers
  1.  
  2. <pre>
  3. Start...  
  4.  
  5. Connecting...
  6. SMTP -> FROM SERVER: bool(true)   
  7.  
  8. Ehlo...
  9. SMTP -> FROM SERVER:  
  10. SMTP -> ERROR: EHLO not accepted from server:  
  11. SMTP -> FROM SERVER:  
  12. SMTP -> ERROR: HELO not accepted from server:  
  13. NULL 
  14.  
  15.  
Googling that thing is just a mess! Any help from mail server experts?
Aug 7 '08 #4
dlite922
1,584 Expert 1GB
here you go:

Expand|Select|Wrap|Line Numbers
  1. require_once("smtp.php");
  2.  
  3.  
  4. echo "<pre>Start...";
  5. $smtp = new SMTP();
  6. $smtp->do_debug = 5;
  7.  
  8. echo "\n\nConnecting...";
  9. var_dump($smtp->Connect("72.16.128.45","25")); 
  10.  
  11.  
  12. echo "\n\nEhlo...";
  13. $smtp->Hello(); 
  14.  
  15. die();
  16.  
  17. // rest of my code if the above works, should work ...
  18.  
output is similar, So i guess if I solve this, i'll get to the root of the problem.


OUTPUT:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <pre>
  3. Start...  
  4.  
  5. Connecting...
  6. SMTP -> FROM SERVER: bool(true)   
  7.  
  8. Ehlo...
  9. SMTP -> FROM SERVER:  
  10. SMTP -> ERROR: EHLO not accepted from server:  
  11. SMTP -> FROM SERVER:  
  12. SMTP -> ERROR: HELO not accepted from server:  
  13. NULL 
  14.  
  15.  
Googling that thing is just a mess! Any help from mail server experts?

I even tried saying EHLO/HELO before connecting, same result.

I'm just about ready to commit suicide guys, i'm at your mercy.


Dan
Aug 7 '08 #5
dlite922
1,584 Expert 1GB
here you go:

Expand|Select|Wrap|Line Numbers
  1. require_once("smtp.php");
  2.  
  3.  
  4. echo "<pre>Start...";
  5. $smtp = new SMTP();
  6. $smtp->do_debug = 5;
  7.  
  8. echo "\n\nConnecting...";
  9. var_dump($smtp->Connect("72.16.128.45","25")); 
  10.  
  11.  
  12. echo "\n\nEhlo...";
  13. $smtp->Hello(); 
  14.  
  15. die();
  16.  
  17. // rest of my code if the above works, should work ...
  18.  
output is similar, So i guess if I solve this, i'll get to the root of the problem.


OUTPUT:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <pre>
  3. Start...  
  4.  
  5. Connecting...
  6. SMTP -> FROM SERVER: bool(true)   
  7.  
  8. Ehlo...
  9. SMTP -> FROM SERVER:  
  10. SMTP -> ERROR: EHLO not accepted from server:  
  11. SMTP -> FROM SERVER:  
  12. SMTP -> ERROR: HELO not accepted from server:  
  13. NULL 
  14.  
  15.  
Googling that thing is just a mess! Any help from mail server experts?

I even tried saying EHLO/HELO before connecting, same result.

I'm just about ready to commit suicide guys, i'm at your mercy.


Dan
Update:

So that you're not blind, here's how the smtp class performs the helo commands:

[PHP]

/**
* Sends a HELO/EHLO command.
* @access private
* @return bool
*/
private function SendHello($hello, $host) {
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);

$rply = $this->get_lines();

$code = substr($rply,0,3);

if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
}

if($code != 250) {
$this->error =
array("error" => $hello . " not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF;
}
return false;
}

$this->helo_rply = $rply;

return true;
}


[/PHP]

it almost looks like $rply is blank, but fputs() writes about 16 bytes.

I'll try to debug get_lines().
Aug 7 '08 #6
Gulzor
27
We use PHPMailer in several projects and we never have that kind of issues. But we like to keep things simple.

Do you use the last version of PHPMailer ? Are you sure that your SMTP server is configured correctly ?

That is weird.
Aug 7 '08 #7
dlite922
1,584 Expert 1GB
We use PHPMailer in several projects and we never have that kind of issues. But we like to keep things simple.

Do you use the last version of PHPMailer ? Are you sure that your SMTP server is configured correctly ?

That is weird.
Hey thanks for the quick reply.

The issue wasn't related to PHPMailer or any PHP issue.

I noticed a couple of times the page would just stall and consume 100% CPU.

So I rebooted it all apache processes and voila! fixed itself.

Everything started working, my script and the PHP Mailer script.

And yes I did grab the latest version.

Don't you hate it when that happens. freakin Windows!!

ugh!!! I'm a day and a half behind in a project.

but damn at least I can sleep tonight.

thanks by the way,



Dan
Aug 7 '08 #8

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

Similar topics

1
by: Leszek | last post by:
Hi. I have problem with phpMailer 1.73 (windows version) After copying both class.phpmailer and class.smtp and also language file phpmailer.lang-pl to my php include directory im getting this...
3
by: Leszek | last post by:
Hi. I have problem with phpMailer 1.73 (windows version) After copying both class.phpmailer and class.smtp and also language file phpmailer.lang-pl to my php include directory im getting this...
0
by: SirShurf | last post by:
Hi, I am using a phpmailer class to send some forms over the email... And the problem is, that some ppl (especially problematic for me is the buyer....) getting the email as rough data (sorce...)...
2
by: prasenjit2007 | last post by:
Hello, can u help me sending Email with attachments using the Class phpMailer. On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name)...
9
by: Lucanos | last post by:
Hi All, I am currently using PHPMailer to send out a set of emails on the execution of a PHP Script (obviously). My problem is that the PHPMailer action is returning a "true" result each time...
5
by: Gilles Ganault | last post by:
Hello To handle an occasionnal flaky ADSL connection, I updated the database that handles incoming calls to have a column that is set to NULL, and then updated to either Y or N depending on...
4
by: mukeshrasm | last post by:
Hi! I want to use phpmailer class to send mail using smtp.I have downloaded the phpmailer and then i followed it's README file where it is mentioned that "Copy class.phpmailer.php into your php.ini...
0
by: mukeshrasm | last post by:
Hi! I want to use phpmailer class to send mail using smtp.I have downloaded the phpmailer and then i followed it's README file where it is mentioned that "Copy class.phpmailer.php into your php.ini...
5
vivekgs2007
by: vivekgs2007 | last post by:
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.