How to send Email through external SMTP server on Ubuntu 14.04
来源:互联网 发布:淘宝预售发货时间 编辑:程序博客网 时间:2024/06/05 09:38
Getting started
- Get an account from SMTP server, e.g. smtp.163.com.
- Install sendmail on Ubuntu 14.04.
Steps
1. Add the domain name(163.com) to /etc/hosts
127.0.0.1 localhost127.0.1.1 myusername-Rev-1-0 163.com
2. Add authentication for SMTP server
mkdir /etc/mail/auth
Add the following line to client-info
AuthInfo:smtp.163.com "U:{somebody}@163.com" "I:{somebody}@163.com" "P:password"
Generate client-info.db by running
makemap hash auth/client-info < auth/client-infoBelow is the files in /etc/mail/auth
/etc/mail/auth/├── client-info└── client-info.db
3. Modify /etc/mail/sendmail.mc
Add the following lines above the MAILER DEFINITIONdnl The following allows relaying if the user authenticates,dnl and disallows plaintext authentication (PLAIN/LOGIN) ondnl non-TLS links:define(`confAUTH_OPTIONS', `A p y')dnlMASQUERADE_AS(`163.com')dnlMASQUERADE_DOMAIN(`163.com')dnlFEATURE(`masquerade_entire_domain')dnlFEATURE(`masquerade_envelope')dnldefine(`SMART_HOST',`smtp.163.com')dnldefine(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnlFEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
4. Run
sendmailconfig
Test
Run mail or sendmail to send an Email.
mail -s "Some fancy title" -r {somebody}@163.com {guest}@aliyun.com <<< "This is the body of our email"Or
sendmail -t -f{somebody} < /testMail.txtwhere the contents of testMail.txt are
From: {somebody}@163.comTo: {guest}@aliyun.comSubject: About the holidayMime-Version: 1.0Content-Type: text/html<body>Hi,This is the mail body.</body></html>
May 19 17:22:32 myusername-Rev-1-0 sm-mta[3230]: u4J8h1lA000457: to=<{guest}@aliyun.com>, ctladdr=<{somebody}@163.com> (1001/1001), delay=00:39:31, xdelay=00:00:01, mailer=relay, pri=300436, relay=smtp.163.com. [220.181.12.17], dsn=2.0.0, stat=Sent (Mail OK queued as smtp13,EcCowACXTzbXhT1X6JpUCg--.64283S3 1463649752)
Reference
http://stackoverflow.com/questions/10359437/sendmail-how-to-configure-sendmail-on-ubuntuhttp://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/
0 0
- How to send Email through external SMTP server on Ubuntu 14.04
- How to test if the server is configured well to send email to external accoun
- Send email through server agent
- how to send email
- android: how to send email
- How to send Email asynchronously
- how to email to external system
- how to send email by jmail?
- How to send email via Django?
- How to send email using sqlserver
- How To Install VNC Server On Ubuntu 14.04
- How to install VNC server on ubuntu 14.04
- How To Install Node.js on an Ubuntu 14.04 server
- How To Set Up an OpenVPN Server on Ubuntu 14.04
- How To Set Up an OpenVPN Server on Ubuntu 14.04
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- Configuring git send-email to use Gmail SMTP
- java Socket实现简单在线聊天(二)
- 注册码生成器 略屌略屌
- apache支持php解析(php安装后无法解析脚本)
- PHP的命名空间
- commons-httpclient post请求乱码问题记录(非编码问题,gzip格式问题)
- How to send Email through external SMTP server on Ubuntu 14.04
- Java基础---泛型
- 64位linux下inet_ntop()返回值竟然为int,printf报段错误
- android 任务Task及回收栈back stack介绍
- Lesson 3 Time Complexity PermMissingElem
- 36.[Leetcode]Valid Sudoku
- 1乘1
- ios开发证书CER文件、P12文件,mobileprovition许可文件的用途
- struts2详细工作流程