On Linux, how does one send emails to QQ mail?

Source: Internet
Author: User
The company generates some reports every day and sends some employees at night. Because the server does not support ssl, I don't quite understand how to re-compile nginx. If the production machine is broken, I can't use phpmailer to send the reports, I heard that I had a mail server in linux, so I could send an email via shell. Could you please give me some advice... the company generates some reports every day and sends some employees at night. Because the server does not support ssl, I don't quite understand how to re-compile nginx. If the production machine is broken, I can't use phpmailer to send the reports, I heard that if you get a mail server in linux, you can send an email via shell.

What I want to do is to automatically send the generated file to other people at every night via the attachment via mail.

Reply content:

The company generates some reports every day and sends some employees at night. Because the server does not support ssl, I don't quite understand how to re-compile nginx. If the production machine is broken, I can't use phpmailer to send the reports, I heard that if you get a mail server in linux, you can send an email via shell.

What I want to do is to automatically send the generated file to other people at every night via the attachment via mail.

It can be done in python.
Use the smtplib module.
First, encode the report and the From and To information To be sent. See RFC http://tools.ietf.org/html/rfc5321#section-2.3.1 for details

We can show you a small demo I wrote.

pythonImport smtplibdef send_email_over_smtps (to_email, login_user, login_pwd): smtpserver = smtplib. SMTP ("", 587) # enter the server address here. 587 is the default smtps port smtpserver. ehlo () smtpserver. starttls () smtpserver. ehlo smtpserver. login (login_user, login_pwd) header = 'to: '+ to_email +' \ n' + 'from: '+ login_user +' \ n' + 'subject: testing \ n' print header msg = header + '\ n this is test msg from mkyong.com \ n \ n' smtpserver. sen Dmail (login_user, to_email, msg) print 'done! 'Smtpserver. close () if _ name _ = "_ main _": send_email_over_smtps ('','','')

Get the file regularly every day, use crontab to get it regularly, and then form an email and send it.

Create an interface on machine B and post an email with machine B in the past.
For the Mail functions to be available, PHP must have access to the sendmail binary on your system
Phpmailer is also used as the system function sendmail
You cannot use phpmailer on your machine. It is estimated that sendmail cannot be used either. Don't expect to use shell to send emails.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.