How to send mail to QQ mailbox on Linux?

Source: Internet
Author: User
Tags how to send mail
The company now generates some reports every day, to the night to send some employees, because the server does not support SSL, recompile Nginx I do not understand, the production machine broke the end, so can not use Phpmailer to send, I heard that in Linux get a mail server, will be able to send mail through the shell, Ask for advice

I want to do is, every night 6 o'clock automatically, the generated files through the mail attachment, sent to the other people email.

Reply content:

The company now generates some reports every day, to the night to send some employees, because the server does not support SSL, recompile Nginx I do not understand, the production machine broke the end, so can not use Phpmailer to send, I heard that in Linux get a mail server, will be able to send mail through the shell, Ask for advice

I want to do is, every night 6 o'clock automatically, the generated files through the mail attachment, sent to the other people email.

It can be done in Python.
Use the Smtplib module.
First of all, the report and the need to send the from, to information, and so on coding. Specifically, you can view the RFC http://tools.ietf.org/html/rfc5321#section-2.3.1

I can show you a little demo I wrote.

pythonimport smtplibdef send_email_over_smtps(to_email,login_user,login_pwd):    smtpserver = smtplib.SMTP("",587) #此处需要填写服务器地址,587是默认smtps端口    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.sendmail(login_user, to_email, msg)    print 'done!'    smtpserver.close()if __name__ == "__main__":    

Every day to get the file, with crontab timed to get, and then compose the mail, send can.

Make an interface on machine B, post used to send e-mail with B machine.
For the Mail functions to be available, PHP must have access to the sendmail binary on your system
Phpmailer is also used as a system function sendmail
You can not use Phpmailer on the machine, it is estimated that sendmail is not used. Don't expect to send mail with the shell.

  • 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.