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.