适用curl连接远程SMTP服务器发送邮件

curl --url 'smtps://smtp.xxx.com:465' --ssl --mail-from 'from_email' --mail-rcpt 'to_email' --upload-file mail.txt --user 'smtp_user:smtp_pass'

其中mail.txt的格式

From: "User Name" <username@gmail.com>
To: "John Smith" <john@example.com>
Subject: This is a test

Hi John,
I’m sending this mail with curl thru my gmail account.
Bye!

 

Leave a Reply

Your email address will not be published. Required fields are marked *