Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using sendmail with file attachments 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I need to know how to use SENDMAIL with file attachments?
Thanks in advance!
 
Unfortunatly Sendmail will not just attach a file for you, You can look into Mime::lite mod though, that will send attachments for you. Sendmail just opens the socket to send off the mail, if you want to really use sendmail and only sendmail and send attachments, (like I do), then you have to encrypt your file on the server using MIME::Base64; then append the encrypted file to your mail, you'll also have to send a lot of information.

See, with email you have what's called a boundary. In the head of the mail you would have to assign a boundary. For each email service they have choosen a boundary. Then when you see that boundary in your head

Content-type: multipart/mixed; boundary="--My_Mail_Boundary.44687.7413";

Then you know you've got an attachment. So the mail readers will then loop through your message and split the message intop parts using your boundary. In each part you have a set of headers, about four lines per header on average.

In the header you must give the content-type, Encoding type, file name, and also, ummmm, well I forgot.

Then it'll work. I've been doing it this way instead of relying on MIME::Lite.

To get a very good idea to do this (I was only trying to give you the overview), get a pop account setup on your server. Go to download simplePop.cgi, then access your pop account with that. Go to Hotmail then send an email with an attachment to your pop account. Then read it, if you read the simplePop.cgi's code you'll see there's a way to print the full header which will show you the boundary and all that stuff, the body you don't have to mess with, it'll show you everything.

Then after you do that, you'll learn a whooooole lot.

Well, Good Luck Mate,

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top