How do I use sendmail instead of mail to send via PHP? -
i have code sends email this, i'd rather use sendmail
instead of default php mailer because want skip php.ini settings:
$to = $_post['email']; $subject = "subject."; $header = "from: me <me@me.com>\r\n"; $header.= "mime-version: 1.0\r\n"; $header.= "content-transfer-encoding: 7bit\r\n"; $header.= sprintf("content-type: %s; charset=\"%s\"","text/html","utf-8")."\n\n"; mail($to, $subject, $html_msg, $header);
what need change use /usr/sbin/sendmail
?
could use popen
?
if on unix-like system, php's "default mailer" is sendmail, don't have change if that's need.
for more details, can see relevant php.ini configuration options in documentation (http://us3.php.net/manual/en/mail.configuration.php).
if don't want use mail()
, yes, talk sendmail popen
, though may instead want use third-party mailer package such swiftmailer, (besides being able send email via smtp/sendmail/postfix) makes easier ensure sent emails formatted.
Comments
Post a Comment