top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How we can send mail with attachment in Python?

+2 votes

How we can send mail with attachment in Python? Is it any prerequisite for it?

posted Jul 19, 2015 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
You could use your favourite search engine to look this up. Or you could poke around with the Python standard library and see if anything looks promising:

Hint: There is something there.

2 Answers

+2 votes

Python's email moudle:

is useful for creating emails. And Python's smtplib module:

is useful for sending them.

answer Jul 20, 2015 by anonymous
+1 vote

You look at the "email" package to build the message and the "smtplib" package to send the message -
both are part of Python's runtime library and documented in its documentation.

Note that you need access to an "smtp" server (aka "mail server"). It ensures in cooperation with other "smtp" servers the distribution of your email around the world. Access to an "smtp" server is a non-Python issue.

answer Jul 20, 2015 by anonymous
Similar Questions
0 votes

I have a dilemma I cant figure out how to send multiple files as an attachment to my email using python script. I can only send a single file attachment .

0 votes

I want to create a random float array of size 100, with the values in the array ranging from 0 to 5. I have tried random.sample(range(5),100) but that does not work. How can i get what i want to achieve?

+2 votes

I'm trying to access Apples iCal-Server on a Mac OS X Snow Leopard Server via Python. The server is up and running and working with it via the iCal-Application is just fine. Now I need to access this server via Python to use it as backend for resource planning.

So how can I read the events within a time range from a user's calendar using python?

+2 votes

I want to use the stdout of child process as an input of another thread, but some how I am not able to read the stdout. Using Popen I have created a child process and stdout of it I have redirected to PIPE (because I don't want that to be printed on with my main process). Now using this statement,"Line=Proc.stdout.readline()" I want to read stdout of child process and I have to do operation on that. but somehow i am not able to read from stdout of child process.

Following is the code snapshot -

Proc = Popen(["python.exe",""],stdout=PIPE)

while True:
            Line = Proc.stdout.readline()
            print Line

Here, process) is continuously printing "Hello World!!" in place of reading stdout of child process.