I want to implement the program which can send automatically emails at the given time of each and Make the effect similar to no-answer_mazon.com.
I have tried a lot of solutions, but none of these solutions work.
Who has given this experience, Please give me a solution
Thanks a lot!
My Python Code & lt; Br> Import smtplib import from email.mime.multipart MIMEMultipart email.mime.text Import from MIMEText # you == recipient's email address me = "no- answer@companyname.com" you = "IDabc@company.com" # message Create Container - The Perfect Mime Type is Multipart / Optional Msg = MIMEMultipart ('Optional') msg ['Subject'] = "Link" msg [From '] = Message [' To '] = You Make Body of Message (A plain-text and an HTML version). Text = "Hello! \ NHow are you? \ NHere's the link you wanted: \ nhttp: //www.python.org" html = "" \ & lt; Html> gt; & Lt; Head & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; P & gt; Oh! & Lt; Br> How are you? & Lt; Br> Here & lt; A href = "http://www.python.org" & gt; Link & lt; / A & gt; You wanted & Lt; / P & gt; & Lt; / Body & gt; & Lt; / Html & gt; "#" # Type the two types of text - MIME type of text / plain and text / html Part1 = MIMEText (text, 'plain') part2 = MIMEText (html, 'html') # attach parts to message container # rfc According to 2046, the last part of the multipart message, in this case # HTML message, is the best and preferred Msg.attach (part1) msg.attach (part2) # Exchange saver Send messages via SMTP server. S = smtplib.SMTP ('outbound.companyname.com') # The dispatch function takes 3 arguments: the sender's address, the recipient's address # and the message to send - here it is sent as a string. S.sendmail (me, you, msg.as_string ()) s.quit ()
No comments:
Post a Comment