Whats the best way to setup sendmail in PHP.ini (sendmail_path or smtp server and port)

Posted on 2009-04-21
Medium Priority
Last Modified: 2013-12-17
I'm just setting up postfix in my PHP.ini and I'm wondering which method I should use, should I point it at the command line to send from /usr/sbin/sendmail or should I use the postfix server so it's send via port 25?

Which is the fastest method? Are there any advantages or disadvantages between both methods?

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = /usr/sbin/sendmail -t -i

Open in new window

Question by:TotallyMe
1 Comment

Accepted Solution

basic612 earned 2000 total points
ID: 24227013
If you have smtp service listening on localhost on port 25 then that would seem to be the best solution in terms of portability - that way your PHP scripts should be able to send mail with no reconfiguration of PHP required if you happen to change your MTA / server setup.

AFAIK the daemon option may be marginally better performance / memory wise, however you're not going to notice any real difference unless you are dealing with a massive load of mail sent per second

When setting up scripts with mailing requirements, I tend to build upon phpmailer (http://phpmailer.codeworxtech.com/) if there's going to be any significant amount of mailing from the script.


Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question