kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

Adding from string #4

Closed BusinessTec closed 9 years ago

BusinessTec commented 9 years ago

I have a fully functioning setup (BTW: great package!). I am not able only to add one point from my test list, adding name of the sender, next to email address itself. Is it possible in the current version?

kootenpv commented 9 years ago

Hey, thanks for the feedback.

I think what you're looking for is to give an alias? It's in the documentation, but I'lll also post it here:

to1 = email1@example.com
to2 = email2@example.com
yag.send(to = to) 
yag.send(to = [to, to2]) # List or tuples for emailadresses *without* aliases
yag.send(to = {to : 'John'}) # Dictionary for emailaddress *with* aliases
yag.send(to = {to : John', to2 : 'Alice'})

So the point is to make a dictionary like {'emailaddr' : 'aliasname'} as the to argument.

Let me know if it works for you, then I'll close the issue.

kootenpv commented 9 years ago

Wow, indeed, there was a bug! The result was sending to the right person, but with a wrong alias (you yourself became the alias, very bad!). You will want to upgrade to the new version (0.3.76).

pip install -U yagmail
pip3 install -U yagmail
BusinessTec commented 9 years ago

Actually I am trying to do the same but 'from' rather then 'to' - tried all combinations but it did not work. Will try with a new version!

kootenpv commented 9 years ago

You were right! Apparently it is required to use 'Alias ' and you can't just use alias. Funny. Please upgrade once more!

yagmail.Connect({'your@email.com' : 'youralias'}).send()

I'll close the issue when you confirm it has been solved.

BusinessTec commented 9 years ago

It works now - thanks a lot for fixing it!

kootenpv commented 9 years ago

You're welcome