473,231 Members | 1,675 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,231 software developers and data experts.

Sending mail with an attachment

p2
Hi,

I know how to send a file as an attachment when the file is in my file
system.

Now I want to send data as attachment without saving it to the
filesystem first.

Under UNIX shell what I do is uuencode and dump the output at the end
of the 'data' part of the message.

How can I convert the string to an attachment without the mediation of
the filesystem?

(The goal is to allow users to request data by email)

Thank you all,

Aug 8 '05 #1
5 1543
*** p2 wrote/escribió (8 Aug 2005 01:00:04 -0700):
Now I want to send data as attachment without saving it to the
filesystem first.

Under UNIX shell what I do is uuencode and dump the output at the end
of the 'data' part of the message.

How can I convert the string to an attachment without the mediation of
the filesystem?


So, your data is not in a file and apparently it's not in a string (or you
wouldn't be asking). Where is it then?
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 8 '05 #2
Hello,

I know that if you send an attachment the file will transformed to
binary data and encoded in some sort of way. If the email has the
neccesary headers (MIME-Version: 1.0\r\nContent-type: multipart/mixed;
boundary=9312495342k5hk45h8\r\n) and is split in to two parts (one
text, one attachment) by the boundary.
Then give the attachment part the right headers (Content type=<type of
file>; name=<filename>\r\nContent-transfer-encoding:
base64\r\nContent-disposition: attachment; filename=<filename>\r\n\r\n)
followed by the data (chunk_split(base64encode($data)))

These are the steps you will have to take.

Good luck!

Aug 8 '05 #3
p2 wrote:
Hi,

I know how to send a file as an attachment when the file is in my file
system.

Now I want to send data as attachment without saving it to the
filesystem first.

Under UNIX shell what I do is uuencode and dump the output at the end
of the 'data' part of the message.

How can I convert the string to an attachment without the mediation of
the filesystem?

(The goal is to allow users to request data by email)

Thank you all,


I have a php class (source:
http://www.ugrad.cs.ubc.ca/~y8r3/code/mailer.html) to handle sending
multi-part emails with attachments. It does not do what you are
looking for currently, but the necessary changes are pretty trivial.
You will, of course, need to know the content-type of your string,
etc.

I'm not sure if this will be helpful for you or not, but it might at
least provide a starting point if you need one.

-Ben

Aug 8 '05 #4
p2
Thank you all,

Eventually I did is:

$mail_msg .= "\nbegin 644 $filename\n";
$mail_msg .= convert_uuencode("$string");
$mail_msg .= "\n`\nend";

But this work with PHP5 only. The function convert_uuencode is new.

Still working on a solution for PHP4.

Thanks.

Aug 8 '05 #5
p2 (an*****@gmail.com) wrote:
: Thank you all,

: Eventually I did is:

: $mail_msg .= "\nbegin 644 $filename\n";
: $mail_msg .= convert_uuencode("$string");
: $mail_msg .= "\n`\nend";

: But this work with PHP5 only. The function convert_uuencode is new.

It also assumes that the mail client does uudecoding. Since uu(en/de)code
is not a standard, you cannot be sure it will always do what you wish.

If possible you should use MIME encoding.
--

This space not for rent.
Aug 8 '05 #6

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

Similar topics

0
by: Dragos Marian Barbu | last post by:
Recently I tried to develop a function to help me sending e-mail messages with more than one attachment. Everything is working OK when I am sebding messages with one attachment, but when I try to...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
0
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
3
by: dnuos | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Here's some details: ...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.