this is the method to send mail by python program.
def Send_Mail(self, username, password, receiver, subject, body):
username = str(username)
password = str(password)
receiver = str(receiver)
subject = str(subject)
body = str(body)
Username = username
Password = password
Sender = username
Destination = [receiver]
Subject = subject
Content = body
text_subtype = 'html'
SMTPserver = 'smtp.gmail.com'
msg = MIMEText(Content, text_subtype)
msg['Subject'] = Subject
msg['From'] = Sender
conn = SMTP(SMTPserver)
conn.set_debuglevel(False)
conn.login(Username, Password)
conn.sendmail(Sender, Destination, msg.as_string())
conn.close()
calling this method by
Classname.Send_Mail(<emailid>,<password>,<destination email-id>,<subject>,<body>
this code is working perfectly,
but need to set expiry date while sending mail,so that sent mail must auto delete from the inbox after specified time.
help would be appreciated.
As far as I know there is no such things as “auto-delete” anywhere in the SMTP or another mail related standard. Additionally I have never heard of a “feature” like this.
So the answer is: You can’t
(Maybe their are mail clients that support such things but this would be a “works only in client X” feature. So for an more useful answer you would have to provide the target client.)