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.
python
import 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.