0

I've already set sendmail_path to the path of 'sendmail.exe', but PHP didn't send email. it requires mail server or something.

PHP said can't connect to localhost at port 25. The fun fact in the php.ini file is that above the path to 'sendmail.exe', stated "Unix only!????", but 'sendmail.exe' is Windows executable. [i believe the sendmail.exe i have in XAMPP is windows version of the Unix sendmail, so the comment in php.ini might not be at right place]

I'm just only sending email, not receiving email, so why do i need a mail server (like Mercury)? or the SMTP (the protocol) requires a server for both sending & receiving?

As per my thinking, we can just open the port (usually 25? 465?) of the destination server to send message to. Anything wrong in my procedure here and above?

Just can't find the details in similar Stackoverflow questions so i bring up this matter, please help me get enlightened.

AnFi
  • 10,493
  • 3
  • 23
  • 47
jondinham
  • 8,271
  • 17
  • 80
  • 137

1 Answers1

1

Only because you find a file called sendmail.exe on your computer it does not mean that PHP supports that specific binary out of the box.

From sendmail_path:

[...] This directive works also under Windows. If set, smtp, smtp_port and sendmail_from are ignored and the specified command is executed.

Double check that sendmail.exe on your disk is compatible with PHP.

Try:

sendmail_path = "X:\path\to\sendmail.exe -t"

I'm just only sending email, not receiving email, so why do i need a mail server (like Mercury)? or the SMTP (the protocol) requires a server for both sending & receiving?

You don't need to. It's only likely that the configuration you use with sendmail.exe (that's not the PHP configuration, look for sendmail.ini instead) that you have told sendmail.exe to use an SMTP server.

Either change that, and if sendmail.exe does not provide the feature you're looking for, replace sendmail.exe with something that matches your needs.

It's just that by default it actually makes sense to send emails. So why are you upset about a configuration that makes sense?

See also:

Community
  • 1
  • 1
hakre
  • 193,403
  • 52
  • 435
  • 836
  • my 'sendmail.exe' and PHP come from the same XAMPP package. when i installed this XAMPP, it even automatically set the 'sendmail_path' in php.ini – jondinham Oct 15 '11 at 11:28
  • but we have to specify the info about smtp server in 'sendmail.ini' anyway. i want to send email directly to destination mx server coz it's faster (less hops), instead of connecting to smtp server and ask it to send to destination server (more hops) – jondinham Oct 15 '11 at 12:01
  • @Paul: Use a local SMTP server for your sendmail and you have exactly that. XAMPP has one I guess, you just only need to start it as well. It could even be the case then everything worked out of the box even. I highly suggest you start to read the documentation that ships with the software you use. – hakre Oct 15 '11 at 12:09
  • i decided to use Mercury, but gmail refused to receive email from my PC, it said: "The IP you're using to send email is not authorized", funny fact about gmail mx server. – jondinham Oct 15 '11 at 13:11
  • 1
    @Paul: Well, that's why normally you just re-use another SMTP server that is properly configured - so you don't need to configure that on your own. However, you wanted to save a hop, and now you have got a much larger problem: How to configure a SMTP server when I do know nothing about SMTP. ;) – hakre Oct 15 '11 at 13:12
  • i'm using gmail smtp now, but just can't fake the sender's email address – jondinham Oct 15 '11 at 18:42