Hi Guys,
I have a small problem which I cannot figure out, but taking my chances with you here. I have the same php script installed on my laptop and on a desktop. If it runs from the laptop, mail goes out and received. If I send it from the desktop, I get a SMTP Error: Could not authenticate notification along with Warning: Cannot modify header information - headers already sent .....

Below is part of the script. Can someone shed some light why one would work and not the other if both are configured the same. Thank-you in advance.

require("class.phpmailer.php");
$mail=new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtphm.XXXXXX.XX";
$mail->SMTPAuth = true;
$mail->Username = "XXX";
$mail->Password = "XXXX";
$mail->From = "webmaster@XXXX.XX";
$mail->FromName ="XXXXX";
$mail->AddAddress("$feedbackemail","$feedbackname");
$mail->WordWrap = 50;
$mail->IsHTML(true);

Recommended Answers

All 8 Replies

Are they exactly the same? Have you copied the files over each other?

That error often appears if there are lines already in a document when it tried to start sessions or make document changes.

Also, what PHP version & settings are you using, firewalls etc? There's quite a few things it could be.

Hi sourcez,
Thanks for your reply. The files are identical. They were copied over from one machine to another. I also re-typed just incase there were some white space, but it still gives the same result. Works fine on the laptop and not on the actual server.

I'm using Apache 2.0.63 / PHP 5.2.5. As for the firewall, I don't think it's an issue as I would of experienced the same issue off the laptop. The laptop is a computer on the network that uses the router as an access point.

I rebooted the machine, but it still gives the same results. I'm lost. I've never experienced this in the past.

If anyone has any idea, I'd really appreciate it. Can't quite figure this one out. Been doing a lot of reading and coming up short.

thanks in advance.

Is it a remote server with a hosting company? Could be a port problem where the port is blocked.

For example, I can't use an apache server when skype is running as skype by default messes with port 80.

Just another idea, hopefully we'll find something.

No, I'm hosting it myself. Regular email go out from that machine all the time. When I was using the mail() it worked without a problem. seeing that my ISP now demands authentication, I decided to use PHPMailer to handle it. I use my laptop to do the developpment and then I transfer it to the main server in the same office. The main server is open to the ports it needs like port 80, 3306, etc...

It's just funny that the laptop sends without a problem and the main server doesn't. I've checked the php.ini file, re-typed in the script and still it won't send from the main server. The server complains about authentication and the laptop doesn't.

Just weird.

Okay, I put in a debugger to see the actual message and here is what I get. Can anyone help me. Thanks. As mentioned works fine on the laptop, but not on the desktop which is a few feet away. Same code, same everything.


SMTP -> FROM SERVER:220 BLU0-SMTP22.blu0.hotmail.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at Mon, 26 Apr 2010 11:13:49 -0700
SMTP -> FROM SERVER: 250-BLU0-SMTP22.blu0.hotmail.com Hello [74.13.171.197] 250-TURN 250-SIZE 35840000 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-TLS 250-STARTTLS 250 OK
SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
SMTP -> FROM SERVER:530 5.7.0 Must issue a STARTTLS command first
SMTP -> ERROR: RSET failed: 530 5.7.0 Must issue a STARTTLS command first
SMTP Error: Could not authenticate.

Member Avatar for rajarajan2017
$mail = new PHPMailer();
	$mail->IsSMTP();
	$mail->SMTPAuth = true;
	$mail->SMTPSecure = "ssl"; 
	$mail->Host = "smtp.gmail.com";
	$mail->Port = 465;

Please give the SMTPSecure, Host and a clear Port number.

IF it is hotmail:
SMTP server: smtp.live.com (Port 25) {Note: If port 25 has been blocked in your network or by your ISP, you can set SMTP port to 587 with TLS or SSL Encryption depending on the client in use}

$mail->SMTPSecure = "ssl"; // use ssl

U can use this line to authenticate SMTP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.