I have a server that has been sending email for the past 2 years, using PHP's mail() function. It runs Windows Server 2003. I have another server, on the same local network as it, running Ubuntu 10.10. Is there a way I could tell a PHP script executed to dump the email into the Windows' SMTP folder to go out?
UPDATE: I'll leave the above, so the other answers make sense, but just for some clarification, here is what I was trying to do. Execute a PHP script via cron on the Ubuntu server that would read a database and dump the emails into its SMTP queue via PHP's mail(), which would in turn relay the emails to a Windows server, which would actually send the emails out.
You can configure the windows box to allow the mail relay from the ubunto box rather than dump files into the smtp folder
Looking down http://php.net/manual/en/function.mail.php (under "Notes") you can make the
mail()
function talk directly to a Mail Transfer Agent running on a remote host (although bizarrely this functionality appears to be unique to the Windows implementation, based on the documentation, so if you ever need to move the script to another platform you'll need to bear this in mind...)Try this, in
php.ini
on the Windows host:You'll need some kind of MTA running on the Ubuntu host, of course, but it's simple enough to install (say) Exim (in the
exim4-daemon-light
package) and configure it to relay mail only from your Windows box.Here is what I did to solve this, since I wasn't clear, and the other answers were backwards (my fault).
I setup ssmtp on the Ubuntu box as per this guide: http://www.davidhurst.co.uk/2007/06/19/php-mail-and-ssmtp-on-debian-linux/ . It involved editing the ssmtp.conf file, and editing php.ini to use a different sendmail_path.
I then configured MailEnable, the SMTP server running on Windows to allow incoming relay connections.
I restarted Apache, and now when I PHP mail() from the Ubuntu box, they get relayed to the Windows SMTP server and sent out.