Python Forum
Email - Send email using Windows Live Mail
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email - Send email using Windows Live Mail
#1
Hi all, 

As above matters, i have some problem how to send email using my default email client (Windows live mail) using Python.

After some exploring, i have found that we can use webbrowser.open or use the win32.client.

I have success to open the compose message but when i try to put attach file, its not appear in the new message box.

Please help. Below is my code.

Thanks



import webbrowser

recipient = '[email protected]'
subject = 'test'
body = 'This is testing message'
attach = r'c:\\Temp\\hhtlatest.txt'

webbrowser.open('mailto:?to='+ recipient + '&subject=' + subject +'&body=' + body + '&attachment=' + attach, new=1)
Reply
#2
The more standard approach is to use smtplib.
Eg:
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

fromaddr = 'Your adress'
toaddr = 'Adress you want to send to'
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = 'Subject of the mail'

body = 'Your message here'
msg.attach(MIMEText(body, 'plain'))

server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('User_name', 'password')
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
Output:
Common smtp servers Name Server Authentication Port Gmail smtp.gmail.com SSL 465 Gmail smtp.gmail.com StartTLS 587 Hotmail smtp.live.com SSL 465 Mail.com smtp.mail.com SSL 465 Outlook.com smtp.live.com StartTLS 587 Office365.com smtp.office365.com StartTLS 587 Yahoo Mail smtp.mail.yahoo.com SSL 465
# TLS
server = smtplib.SMTP("smtp.mail.yahoo.com", 587)

# SSL
server = smtplib.SMTP_SSL('smtp.mail.yahoo.com', 465)
Reply
#3
Thanks for the reply.

It's going fine and good to use smtplib. But in my enviroment, i need to create program that to be use with 30 different users and they have each own email address.

I try to find  solution that, the program will use default email client in their PC to send the data using python. I just find out the information about Outlook only.

Not for others application such as Windows Live Mail.

Please help.

Thanks you Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sound Sensor With EMail Notification parascand 1 491 Dec-10-2023, 03:10 AM
Last Post: deanhystad
  Save image from outlook email cubangt 1 711 Jun-07-2023, 06:52 PM
Last Post: cubangt
  Sent email based on if condition stewietopg 1 870 Mar-15-2023, 08:54 AM
Last Post: menator01
  How to horizontally align and display images side-by-side in an email using Python? shantanu97 0 1,011 Feb-22-2023, 11:41 PM
Last Post: shantanu97
  Looking to automate updating a spreadsheet with image from email cubangt 2 986 Feb-14-2023, 03:43 PM
Last Post: cubangt
Question Email and TLS only, how ? SpongeB0B 1 1,018 Feb-06-2023, 02:09 PM
Last Post: SpongeB0B
  Send email with smtp without using Mimetext mgallotti 0 718 Feb-01-2023, 04:43 AM
Last Post: mgallotti
  Get sender of email Pedroski55 0 1,584 Dec-03-2022, 09:23 AM
Last Post: Pedroski55
  is it possible to copy image from email and place into excel file? cubangt 3 1,283 Nov-30-2022, 05:11 PM
Last Post: snippsat
  email Library: properly send message as quoted-printable malonn 3 1,345 Nov-14-2022, 09:31 PM
Last Post: malonn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020