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.

9
  • 2
    Well, what platform are you on? Commented Oct 15, 2011 at 10:49
  • 2
    So basically you want to send emails from a windows box using sendmail.exe you found somewhere? Commented Oct 15, 2011 at 10:49
  • @Pekka i'm on windows 7 with XAMPP Commented Oct 15, 2011 at 10:53
  • @Furicane: my 'sendmail.exe' is in the XAMPP package (which inludes Apache,PHP,FileZilla,Mercury) Commented Oct 15, 2011 at 10:55
  • 2
    nevermind, you actually need a smtp server running "somewhere", either localhost or a public wide open smtp. so, yes you do need a smtp server either for php mail, swift mailer etc. There are also smtp libs like hamster that work, but it is too a smtp server running locally. Commented Oct 15, 2011 at 11:05

1 Answer 1

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:

Sign up to request clarification or add additional context in comments.

6 Comments

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
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)
@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.
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.
@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. ;)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.