SendMail is the most widely used message transfer agent for mail delivery/acceptance in UNIX environments. Here's how to use SendMail to work with PHP email
Install SendMail and MAILX
Yum-y Install SendMail MAILX
Start
/etc/rc.d/init.d/sendmail start
Of course, you have to boot automatically.
Vim/etc/rc.local
Add the following code after rc.local
/etc/rc.d/init.d/sendmail start
This simple environment is built to complete
php uses mail () to send mail
Mail ()
Mail ("Recipient email", "Mail Subject", "Body content", "From: Sender email");
The code is as follows |
Copy Code |
<?php $from = ' admin@waynerQiu.com '; $to = ' 78282385@qq.com '; $title = ' time you 123! @#¥%......&* () Subject '; $subject = "=? UTF-8? B? ". Base64_encode ($title). "? ="; $body = ' <a href= ' http://www.111cn.net "target=" _blank ">test link</a>"; $headers [] = "From: $from"; $headers [] = "x-mailer:php"; $headers [] = "mime-version:1.0"; $headers [] = "content-type:text/html; Charset=utf8 "; $headers [] = "reply-to: $from"; Mail ($to, $subject, $body, implode ("\ r \ n", $headers), "F-$from"); ?> |
Screenshot of message received after sending: