[sylpheed:36803] using a python program to send e-mail with sylpheed
maitra at email.com
Sun Apr 28 08:43:52 JST 2019
I am trying to figure out how to use sylpheed with sending e-mail in python (which is the only way that I can send e-mail from work).
I have the following python script (which is deliberately simple at this stage for me to simply understand what to do).
from email.mime.text import MIMEText
# Prompt the user for connection info
to_email = input('Recipient: ')
servername = input('Mail server name: ')
serverport = input('Server port: ')
serverport = int(serverport)
serverport = 25
use_tls = input('Use TLS? (yes/no): ').lower()
username = input('Mail username: ')
password = getpass.getpass("%s's password: " % username)
# Create the message
msg = MIMEText('Test message from PyMOTW.')
msg['To'] = email.utils.formataddr(('Recipient', to_email))
msg['From'] = email.utils.formataddr(('Author', username))
msg['Subject'] = 'Test from PyMOTW'
if use_tls == 'yes':
print('starting with a secure connection')
server = smtplib.SMTP_SSL(servername, serverport)
print('starting with an insecure connection')
server = smtplib.SMTP(servername, serverport)
# identify ourselves, prompting server for supported features
# If we can encrypt this session, do it
server.ehlo() # reidentify ourselves over TLS connection
I can get it to work with my mail server, etc from the command line when I send the e-mail in the following way (note that the program is called mailsend.py and is an executable).
Then, I am asked the following:
Whether TLS or not
to which stdin output is required and upon correct submission, the e-mail is successfully sent.
My question is how do I get the sylpheed mailer to submit these stdin output so that the script can take over from here and deliver.
I am happy to provide more information.
Many thanks in advance for any help, and I am sorry if this is a trivial question. I am not very familiar with the sending side of things and I still want to be able to use sylpheed.
More information about the Sylpheed