星期五, 2月 22, 2013

FW: 使用sendmail 寄信 relay via SMTP server (attach to mail body)

Pre-Step:

vi /etc/mail/sendmail.mc

 

dnl define(`SMART_HOST', `your_smtp_server')dnl

 

or

 

vi /etc/mail.sendmail.cf

O DaemonPortOptions=Port=smtp,Addr= your_smtp_server, Name=MTA

Dj your_domain.com

 

How to:

http://devrandom.wikispaces.com/Sending+HTML+Formatted+email+directly+via+SendMail+from+BASH

 

(

echo "Subject: <Mail Subject>";

echo "MIME-Version: 1.0";

echo "Content-Type: text/html";

echo "Content-Disposition: inline";

echo "

<html>

<body>

HTML body for email

<pre>

`ls / #Use backticks to include the output of Linux/Unix commands`

</body>

</html>

"

) | /usr/sbin/sendmail <Recipient email addresses>

 

To send a pre generated HTML file as email via sendmail, use the following:

 (

echo "Subject: <Mail Subject>";

echo "MIME-Version: 1.0";

echo "Content-Type: text/html";

echo "Content-Disposition: inline";

cat <Pre generated HTML file to use as mail body>;

) | /usr/sbin/sendmail <Recipient email addresses>

 

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...