freelanceprogrammers.org Forum Index » PHP

how to send attachment with email in php? HELP plz.


View user's profile Post To page top
mr_sohail_khan Posted: Fri Sep 30, 2005 3:23 pm


Joined: 30 Sep 2005

Posts: 2
how to send attachment with email in php? HELP plz.
Hi Gurus....

Plz any body can help me in sending email with attachment in php.

Plz Hurry Up......
Thnx in advance...

Khan
Reply with quote
Send private message
View user's profile Post To page top
eaguilac Posted: Fri Sep 30, 2005 11:22 pm


Joined: 06 Sep 2005

Posts: 2
how to send attachment with email in php? HELP plz.
Mira esta librería : libmail.php





Salu2.

XTeo



_____

De: php-objects@yahoogroups.com [mailto:php-objects@yahoogroups.com] En
nombre de Muhammad Sohail Khan
Enviado el: Viernes, 30 de Septiembre de 2005 6:24
Para: php-objects@yahoogroups.com
Asunto: [php-objects] how to send attachment with email in php? HELP plz.



Hi Gurus....

Plz any body can help me in sending email with attachment in php.

Plz Hurry Up......
Thnx in advance...

Khan







PHP Data object relational mapping generator - http://www.meta-language.net/





_____

YAHOO! GROUPS LINKS



* Visit your group "php-objects
<http://groups.yahoo.com/group/php-objects> " on the web.

* To unsubscribe from this group, send an email to:
php-objects-unsubscribe@yahoogroups.com
<mailto:php-objects-unsubscribe@yahoogroups.com?subject=Unsubscribe>

* Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.



_____



[Non-text portions of this message have been removed]
Reply with quote
Send private message
View user's profile Post To page top
jotamadson Posted: Fri Sep 30, 2005 11:40 pm


Joined: 19 Mar 2005

Posts: 4
how to send attachment with email in php? HELP plz.
Have a look at the message below extracted
from http://www.php.net/manual/en/ref.mail.php
---------------------------------------------------
jdephix at hotmail dot com
02-Mar-2005 03:25
How to add multiple attachment to an email:

An email can be split into many parts separated by a
boundary followed by a Content-Type and a
Content-Disposition.

The boundary is initialized as follows:
<?php
$boundary = `-----=` . md5( uniqid ( rand() ) );
?>

You can attach a Word document if you specify:
<?php
$message .= "Content-Type: application/msword;
name="my attachment"
";
$message .= "Content-Transfer-Encoding: base64
";
$message .= "Content-Disposition: attachment;
filename="$theFile"

";
?>

When adding a file you must open it and read it with
fopen and add the content to the message:
<?php
$path = "whatever the path to the file is";
$fp = fopen($path, `r`);
do //we loop until there is no data left
{
$data = fread($fp, 8192);
if (strlen($data) == 0) break;
$content .= $data;
} while (true);
$content_encode =
chunk_split(base64_encode($content));
$message .= $content_encode . "
";
$message .= "--" . $boundary . "
";
?>

Add the needed headers and send!
<?php
$headers = "From: "Me"<me@...>
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: multipart/mixed;
boundary="$boundary"";
mail(`myAddress@...`, `Email with attachment
from PHP`, $message, $headers);
?>

Finally, if you add an image and want it displayed in
your email, change the Content-Type from attachment to
inline:

<?php
$message .= "Content-Disposition: inline;
filename="$theFile"

";
?>

Enjoy!


--- Muhammad Sohail Khan <mr_sohail_khan@...>
escreveu:


---------------------------------
Hi Gurus....

Plz any body can help me in sending email with
attachment in php.

Plz Hurry Up......
Thnx in advance...

Khan







PHP Data object relational mapping generator -
http://www.meta-language.net/



---------------------------------
YAHOO! GROUPS LINKS


Visit your group "php-objects" on the web.

To unsubscribe from this group, send an email to:
php-objects-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.


---------------------------------











_______________________________________________________
Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito
mais. Instale agora!
www.yahoo.com.br/messenger/
Reply with quote
Send private message
View user's profile Post To page top
pcre2002 Posted: Sat Oct 01, 2005 1:49 pm


Joined: 01 Oct 2005

Posts: 1
how to send attachment with email in php? HELP plz.
Hi,

Don`t reinvente the wheel trying to code it yourself!
You can use a library such as:
http://phpmailer.sourceforge.net/

Pierre

php-objects@yahoogroups.com a écrit :
>
> There are 2 messages in this issue.
>
> Topics in this digest:
>
> 1. how to send attachment with email in php? HELP plz.
> From: "Muhammad Sohail Khan" <mr_sohail_khan@...>
> 2. Re: how to send attachment with email in php? HELP plz.
> From: Jean Madson <jotamadson@...>
>
>
> ________________________________________________________________________
> ________________________________________________________________________
>
> Message: 1
> Date: Fri, 30 Sep 2005 10:23:45 -0000
> From: "Muhammad Sohail Khan" <mr_sohail_khan@...>
> Subject: how to send attachment with email in php? HELP plz.
>
> Hi Gurus....
>
> Plz any body can help me in sending email with attachment in php.
>
> Plz Hurry Up......
> Thnx in advance...
>
> Khan
>
>
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help