Hi Guys,

Hope you can help me with this little conundrum I'm having currently.

My company has a dedicated windows server with heart internet and for means of database interaction, we've been forced to move one of our php sites to there. Everythings great and works fine - except the mail function.

The SMTP server is hooked up using MailEnable - I'm absolutely clueless on how windows servers work so forgive me for sounding silly asking this question.

The problem I'm having has been constant across everything I try - I get authentication errors. The latest attempt gives the most information - PHPmailer:

SMTP -> FROM SERVER: 220 mail12.extendcp.co.uk ESMTP Exim Fri, 09 Dec 2011 23:12:50 +0000 SMTP -> FROM SERVER: 250 mail12.extendcp.co.uk Hello ds-xxxxx.ds-x.com [] SMTP -> ERROR: AUTH not accepted from server: 503 AUTH command used when not advertised Mailer Error: SMTP Error: Could not authenticate

The script which ouputs this is as follows:
(emails and server names changed)


$mail             = new PHPMailer();

	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
											   // 1 = errors and messages
											   // 2 = messages only
	$mail->SMTPAuth   = true;                  // enable SMTP authentication
//	$mail->SMTPSecure = "TLS";

	$mail->Host       = "mail.smtp.co.uk"; // sets the SMTP server
	$mail->Port       = 587;                    // set the SMTP port for the GMAIL server
	$mail->Username   = "mail@smtp.co.uk"; // SMTP account username
	$mail->Password   = "xxxxx";        // SMTP account password

	//$mail->SetFrom('name@yourdomain.com', 'First Last');

	$mail->AddReplyTo("name@yourdomain.com","First Last");

	$mail->Subject    = "PHPMailer Test Subject via smtp, basic with authentication";

	$address = "tom@test.co.uk";
	$mail->AddAddress($address, "John Doe");
	if(!$mail->Send()) {
	  echo "Mailer Error: " . $mail->ErrorInfo;
	} else {
	  echo "Message sent!";

That's taken from an example on the phpmailer site. I'm certain I've got the correct class files (as for some reason I downloaded the wrong ones from their site earlier!)

I'm also aware of the odd port number, that's what heart recommended.

Can anyone recommend and advise? I've tried everything to get this working and I'm all out of ideas - plus I'm a complete n00b as stated earlier.


Recommended Answers

All 2 Replies

First off, welcome to the utterly miserable world of the Windows Server Environment.

I struggled with this same exact issue, and spoke to one of my Networking guys here at work. It ended up being an issue with the ACL, and our Network guy had to add an exception on the network to allow SMTP emails to be sent from a web site.

For me it wasn't a programming issue, but instead a Networking/Server Admin problem. Talk to those guys in your office and you should be fine. Your code looks good to me, but normally Auth issues are networking problems (unless your credentials are a bad username/pw).

Good Luck!

Wow, thanks for the fair and polite reply - that's the reason I went on here first to ask a support question, because the replies on similar issues to mine haven't been mindless or snotty.

Um yeah, thanks for your reply anyway. I try to stay away from Windows Servers as much as possible! Connecting to the server evokes the same feeling as walking into a dentist before an appointment!

I'll get onto heart internet and see what they say about this ACL thing. I'm sure the credentials are fine as I made sure with them first.

Thanks for your help, i'll post back when I know.


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.