Norman Peelman wrote:
r0g wrote:
>I'd like PHP to send mail to a local mailserver running at localhost:25
like I used to on windows. This mailserver is a dummy server which just
writes the mail to disk for unit testing and works fine when I use
thunderbird to send mail to it and used to work fine under windows
however...
<snip>
>Is there any way I can
persuade PHP to simply try to deliver the mail to my local machine's
port 25 (dummy server) like it used to in Windows XP?
Roger.
I had trouble configuring/using 'sendmail' properly so I ended up
installing 'postfix' ('postfix' calls itself 'sendmail' so you don't
change anything in 'php.ini'). You can find your system mail in
'/var/mail/<usrname>'. You will probably need to edit the
'/etc/postfix/main.cf' file with:
myhostname = <machinehostname>
mydestination = <machinehostname>, localhost.localdomain, localhost
relayhost = <smtp-server.name.here>
You should then be able to send mail local and outbound through PHP's
mail() function. ex: <username>@<machinehostname>
Hi there and thanks for all you suggestions.
@Michael, PHPmailer would accompish this but I don't want to add any
extra code to my project if I can avoid it so I think I'll hav to go the
MTA route.
@C, I like the simplicity of your suggestion as all these MTA's look
unnecessarily heavy for what I want, but sadly I couldn't get it to
work, plus the unit tests I have expect separate files as generated by
the dummy SMTP server program
@Norman, I'm clearly missing something here - Whenever I install
postfix, no matter what options I choose at install time, it grabs port
25 and my dummy server can't start up. The only time it doesn't is if I
install it and select 'No configuration'. The option that looked best
was 'Internet with smarthost' which let me enter a relay server address
(in my case localhost) and, in main.cf, created exactly the settings you
describe above but it then proceeded to grab port 25 :-{ So my question
is now...
Should I plod on with the 'No configuration' install, plough though
countless forum and Usenet posts and try and make it use my local smtp
server or...
Have I got the wrong end of the stick entirely here?
I'm assuming from the settings in php .ini and what I've read that this
sendmail/postfix mechanism is file/pipe based rather than socket based
and that applications call the application, hand off the mail they want
sending to it, it then contacts the appropriate server (or relay) and
delivers it. If this is the case why is postfix grabbing port 25? And
why can't php on linux just squirt this info straight to a named port
like it can in windows? Am I missing a module or is that just not done?
Yours confused,
Roger Heathcote.