Jump to content

PHP sending through SMTP


Demonwolf
 Share

Recommended Posts

Hi all I have a MS Server 2008R2 set up with IIS7 In IIS I have set up an SMTP (with the IIS6 requirements) and the standard PHP that you get with it all. The SMTP server works. Reason we have to use a local SMTP server to interface with our actual mail server is because the external server requires TLS authentication and many smaller office scanning machines don't support it. I am able to send mail through the SMTP without issue, both from an office MFP and from a mail client like Outlook 2010. The PHP works too. I have it displaying PHP webpages and even going as far as accessing ODBC data resources. However, the two of them don't work together. I create a basic webpage that is as follows:

<html><body>  <?php   if (mail("me@example.com","Test Subject","Test body"))	{echo "success";}	else	{echo "failed";}  ?></body><html>

I also have the following in the PHP.ini I found in "C:\Program Files (x86)\PHP\v5.3\"

[mail function]SMTP = localhostsmtp_port = 25sendmail_from = no-reply@example.com

And yet, all I get is "failed" each time I have run the webpage. Anyone have any ideas on where I can get the PHP/SMTP/Other logs to give me more information? I have monitored the queue folder for the SMTP and it doesn't seem to even receive the mail from the PHP site.

Link to comment
Share on other sites

Guest LH91325

There's only two things I can think of at the moment. 1. You might want to introduce a from header in your call to mail(), even though you have a default. Maybe it will change something.. 2. Add more error reporting: http://php.net/manual/en/function.error-reporting.php (turn it on to maximum) It's too bad mail() returns only true and false. Not much information there. (Just 1 bit.) I doubt either suggestion will help but it's better than trying nothing.

Link to comment
Share on other sites

There's only two things I can think of at the moment. 1. You might want to introduce a from header in your call to mail(), even though you have a default. Maybe it will change something.. 2. Add more error reporting: http://php.net/manua...r-reporting.php (turn it on to maximum) It's too bad mail() returns only true and false. Not much information there. (Just 1 bit.) I doubt either suggestion will help but it's better than trying nothing.
Thanks. I have tried adding the "from" into the call of mail. It is how I had it originally and it changed nothing. I went hunting for more logs and found something in the PHP logs that it is not connecting to the mail server at all. I think it may be my SMTP, I cannot telnet to that server on port 25.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...