473,785 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHPMailer Complications

dlite922
1,584 Recognized Expert Top Contributor
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 "technicall y" 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("c onfig.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@dmconsu ltingonline.com ";
$mail->FromName = "Mailer";
$mail->AddAddress("dm urad@dmconsulti ngonline.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 22839
Gulzor
27 New Member
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 Recognized Expert Top Contributor
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.local domain ESMTP Sendmail 8.13.8/8.13.8; Thu, 7 Aug 2008 01:53:26 -0600
EHLO localhost
250-localhost.local domain Hello mydomain.com [x.x.x.x], pleased to meet you
250-ENHANCEDSTATUSC ODES
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=23 5 2.0.0 OK Authenticated
MAIL FROM: myemail@hotmail .com
250 2.1.0 myemail@hotmail .com... Sender ok
RCPT TO: myemail@another host.com
250 2.1.5 myemail@another host.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.local domain 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 Recognized Expert Top Contributor
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 Recognized Expert Top Contributor
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 Recognized Expert Top Contributor
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($hell o, $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 New Member
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 Recognized Expert Top Contributor
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
12584
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 error when I'm trying to use phpMailer: Mailer Error: Language string failed to load: recipients_failed Does anyone konw the reason for this error?
3
2591
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 error when I'm trying to use phpMailer: Mailer Error: Language string failed to load: recipients_failed Does anyone know the reason for this error?
0
1426
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...) here is the emal itself as they get it (the headers are below...) Code: X-Tour4Less.co.il Mailer: MIME-Version: 1.0
2
4560
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) 2)To 3) Subject 4) Message5) File input(name abc) - to be sent as an attachment. This form calls the Class PhpMailer through another form with the following code to send the mail. <?php ini_set("include_path",...
9
2434
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 it is executed, but not every email generated by this action is actually being sent. My account is hosted on HostMonster, and is pointed at the localhost as the SMTP server.
5
2743
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 whether a PHP CLI script was able to send a notification e-mail to support. To send an e-mail through out ISP's SMTP server, I'm using PHPMailer 2.0.0 rc3 http://phpmailer.sourceforge.net which worked fine until we had some connection loss. I'm at...
4
4939
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 include_path. If you are using the SMTP mailer then place class.smtp.php in your path as well", but I don't know where to paste the class.phpmailer.php into my php.ini include_path. I am using WAMP Server. and it is in c drive.
0
4350
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 include_path. If you are using the SMTP mailer then place class.smtp.php in your path as well", but I don't know where to paste the class.phpmailer.php into my php.ini include_path. In my php.ini file the include path is commented and it is like ...
5
6723
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 in this.. 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');...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.