Python Forum
Sending Attachments via smtplib [SOLVED]
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending Attachments via smtplib [SOLVED]
#3
If use yagmail it's easier.
Quick test works fine for me.
import yagmail

receiver = "[email protected]"
body = "Hello there from Yagmail"
filename = "test.pdf"

yag = yagmail.SMTP("[email protected]", pass-xxxx)
yag.send(
    to=receiver,
    subject="Python test with attachment",
    contents=body, 
    attachments=filename,
)
Reply


Messages In This Thread
RE: Sending Attachments via smtplib - by Larz60+ - Oct-27-2021, 10:45 PM
RE: Sending Attachments via smtplib - by snippsat - Oct-27-2021, 11:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  smtplib send email has no timestamp Pedroski55 2 1,774 Jun-11-2024, 04:57 AM
Last Post: Pedroski55
  code to send attachments contained on the drive. stefanoste78 1 1,575 Oct-12-2022, 02:16 AM
Last Post: Larz60+
  I get attachment paperclip on email without any attachments monika_v 5 3,495 Mar-19-2022, 10:20 PM
Last Post: cosmarchy
  Unable to send email attachments cosmarchy 7 4,640 Mar-09-2022, 09:29 PM
Last Post: bowlofred
  Sending random images via smtplib [SOLVED] AlphaInc 0 2,367 Oct-19-2021, 10:10 AM
Last Post: AlphaInc
  [UnicodeEncodeError from smtplib] yoohooos 0 4,472 Sep-25-2021, 04:27 AM
Last Post: yoohooos
  Understanding The Arguments for SMTPlib - sendmail JoeDainton123 3 3,909 Aug-03-2020, 08:34 AM
Last Post: buran
  TimeOutError when trying to initiate smtplib.SMTP thecosmos 0 4,527 Jun-19-2020, 05:30 AM
Last Post: thecosmos
  SMTPlib help tpolim008 4 6,033 Apr-27-2020, 11:11 PM
Last Post: tpolim008
  smtplib: string formatting not carrying over to email ClassicalSoul 1 3,579 Apr-22-2020, 09:58 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

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