Skip to content

Sending attachment fails #228

Open
@PrimusRising

Description

@PrimusRising

Thanks for making yagmail.
I'm running yagmail-0.15.277 on python 3.10.

I can't seem to attach a file to my email.
The email arrives just fine but without attachment.

In the code, shown below, I'm sending it to my protonmail account, also when I try to send to a gmail it also fails.

here's the code:

import yagmail
import os

textattach = os.path.join(os.getcwd(), 'test.txt')
print(textattach)

yag = yagmail.SMTP(user='[email protected]', password='hunter2')
#sending the email
yag.send(to='[email protected]', 
	subject='The subject is bla bla bla', 
	contents='Please find the text file attached', 
	attachments=textattach)

print("Email was sent")

The output is as follows:

C:\Users\RegularUsername\Documents\Scripts\email\test.txt
Email was sent

When opening the path (C:\Users\RegularUsername\Documents\Scripts\email\test.txt) it shows the txt file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions