473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Attached images by plain email.

Gaz
Hi guys. Im doing a simple CGI form to send data by email. They are for
some technicians on field so they can send daily reports about what
they made. The thing is, i dont know how to send images attached to the
email i generate with sendmail. I put the combos in the form, but i
dont know how to say to sendmail to add them to the email the form
assembles.

Any tips?

Thanks!

Feb 15 '06 #1
4 1384
Hi Gaz,

Perhaps this will help?

http://aspn.activestate.com/ASPN/Coo...n/Recipe/52243

Feb 15 '06 #2
Gaz
You are the man!

Feb 16 '06 #3
Gaz
Can you help me a little bit more? Please check this out:
102 part.addheader('Content-Transfer-Encoding', 'base64')
103 body = part.startbody('image/jpeg; name=c:\check.jpg')
104 base64.encode(open('check.jpg', 'rb'), body)
105
106
base64 = <module 'base64' from '/usr/lib/python2.3/base64.pyc'>,
base64.encode = <function encode>, builtin open = <type 'file'>, body =
<StringIO.StringIO instance>

IOError: [Errno 2] No such file or directory: 'check.jpg'
args = (2, 'No such file or directory')
errno = 2
filename = 'check.jpg'
strerror = 'No such file or directory'

Feb 20 '06 #4
Seems like you are not providing a full path to the file 'check.jpg'.
How is your program supposed to know where in the filesystem it
is located? Either that, or you have to put the file in the same
directory that on which the program is running.

Also, you should use two backslashes in the name: part

body = part.startbody('image/jpeg; name=c:\\check.jpg')

This is because \ is the escape character in strings. If you
mean a literal backslash, it has to escape itself. Hence,
you use \\

Hope that helps!
-Luis

Feb 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ralph Freshour | last post by:
I'm trying to add images to a TEXTAREA tag (in my PHP web page) using the usual image tag: <INPUT TYPE="image" etc. But the images are not showing up in the TEXTAREA but rather outside, below...
2
by: Dean J. Garrett | last post by:
Hi, I need to create HTML e-mail from an ASP program that includes embedded images that go along with the e-mail, e.g. logos, product image, etc. Is there a technique in HTML that people use to...
3
by: stan k. | last post by:
First of all let me clarify - I am not talking about having a bunch of images loaded all at once (or preloaded) and then controlling the display of the images after that point -- I know that can be...
7
by: sonic | last post by:
Hello, I am cloning a table row which contains images that have behaviors attached to them as well as onclick events. The problem is that the cloned row seems to be executing the...
3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
1
by: krishan123456 | last post by:
i have tried to send email with attached doc file but when i receive the mail i find the attached file in encoded text instead of actuall attachment.the code that i used to send an email is given...
1
by: SipherDrakon | last post by:
I know I saw a similar posting about this but mine is a little more complicated and being barely able to understand javascript, i am having a little trouble. <FORM...
4
by: Ken Fine | last post by:
I've been living with a frustrating issue with VS.NET for some months now and I need to figure out what the problem is. Hopefully someone has run into the same issue and can suggest a fix. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.