Python Forum
Understanding The Arguments for SMTPlib - sendmail - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Understanding The Arguments for SMTPlib - sendmail (/thread-28746.html)



Understanding The Arguments for SMTPlib - sendmail - JoeDainton123 - Aug-02-2020

Hello all

I am trying to understand how to input the different arguments for SMTPlib - sendmail.

I have the following code:-

From_Address = "From Email"
To_Address = "To Email"
Body = "This is the body of the email"

mail.sendmail(from_addr: From_Address, to_addrs: To_Address, msg = Body)

But i keep getting an error stating invalid syntax even though i have entered the semi colons exactly as the help pop up.

My question is how do you interpret the help pop up which shows the different arguments.

Can anyone help?

Thank you.

İmage



RE: Understanding The Arguments for SMTPlib - sendmail - buran - Aug-02-2020

this
mail.sendmail(from_addr: From_Address, to_addrs: To_Address, msg = Body)
should be
mail.sendmail(from_addr=From_Address, to_addrs=To_Address, msg = Body)
that is assuming mail is smtplib.SMTP instance


RE: Understanding The Arguments for SMTPlib - sendmail - JoeDainton123 - Aug-02-2020

buran

Thank you for the reply.

Your command:-

mail.sendmail(from_addr=From_Address, to_addrs=To_Address, msg = Body)
But when i open the brackets for this command a dialogue menu opens which shows the arguments and each argument as a : not a =, so would interpret all : as equals?


RE: Understanding The Arguments for SMTPlib - sendmail - buran - Aug-03-2020

(Aug-02-2020, 07:42 PM)JoeDainton123 Wrote: But when i open the brackets for this command a dialogue menu opens which shows the arguments and each argument as a : not a =, so would interpret all : as equals?
It's not clear what you mean by "a dialogue menu opens"? Do you mean that you get some inetlisense hint as to what the arguments are expected?
Maybe look at basics as to how you pass [keyword] arguments to functions.