List Info

Thread: note 61644 added to ref.mail




note 61644 added to ref.mail
user name
2006-02-08 10:16:06
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file rn rn [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...
<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')):
$eol="rn"; elseif
(strtoupper(substr(PHP_OS,0,3)=='MAC')):
$eol="r"; else: $eol="n"; endif; ?>

<?php
# File for Attachment
$f_name="../../letters/".$letter;    // use
relative path OR ELSE big headaches. $letter is my file for
attaching.
$handle=fopen($f_name, 'rb');
$f_contents=fread($handle, filesize($f_name));
$f_contents=chunk_split(base64_encode($f_contents));   
//Encode The Data For Transition using base64_encode();
$f_type=filetype($f_name);
fclose($handle);
# To Email Address
$emailaddress="himher.com";
# Message Subject
$emailsubject="Heres An Email with a
PDF".date("Y/m/d H:i:s");
# Message Body
ob_start();
  require("emailbody.php");     // i made a simple
& pretty page for showing in the email
$body=ob_get_contents(); ob_end_clean();

# Common Headers
$headers .= 'From: Jonny <jongenius.com>'.$eol;
$headers .= 'Reply-To: Jonny <jongenius.com>'.$eol; 
$headers .= 'Return-Path: Jonny <jongenius.com>'.$eol;     // these two to set reply
address
$headers .= "Message-ID: <".$now."
TheSystem".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;  
        // These two to help avoid spam-filters
# Boundry for marking the split & Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol; 
$headers .= "Content-Type: multipart/related;
boundary="".$mime_boundary.""".$e
ol; 
$msg = "";

# Attachment
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: application/pdf;
name="".$letter.""".$eol;   //
sometimes i have to send MS Word, use 'msword' instead of
'pdf'
$msg .= "Content-Transfer-Encoding: base64".$eol;
$msg .= "Content-Disposition: attachment;
filename="".$letter.""".$eol.$eol
; // !! This line needs TWO end of lines !! IMPORTANT !!
$msg .= $f_contents.$eol.$eol;
# Setup for text OR html
$msg .= "Content-Type:
multipart/alternative".$eol; 

# Text Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/plain;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= "This is a multi-part message in MIME
format.".$eol;
$msg .= "If you are reading this, please update your
email-reading-software.".$eol;
$msg .= "+ + Text Only Email from Genius Jon +
+".$eol.$eol;

# HTML Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= $body.$eol.$eol;

# Finished
$msg .=
"--".$mime_boundary."--".$eol.$eol;   //
finish with two eol's for better security. see Injection.

# SEND THE EMAIL
ini_set(sendmail_from,'fromme.com');  // the INI lines
are to force the From Address to be used !
  mail($emailaddress, $emailsubject, $msg, $headers); 
ini_restore(sendmail_from);
?>

I hope this helps.
Jon Webb [Madrid&bond]
----
Server IP: 130.206.1.5
Probable Submitter: 80.59.81.178
----
Manual Page -- http://www.
php.net/manual/en/ref.mail.php
Edit        -- http://master.php.net/manage/user-notes.php?action=
edit+61644
Delete: added to the manual -- htt
p://master.php.net/manage/user-notes.php?action=delete+61644
&report=yes&reason=added+to+the+manual
Delete: bad code            -- http://master.
php.net/manage/user-notes.php?action=delete+61644&report
=yes&reason=bad+code
Delete: spam                -- http://master.php.
net/manage/user-notes.php?action=delete+61644&report=yes
&reason=spam
Delete: useless             -- http://master.p
hp.net/manage/user-notes.php?action=delete+61644&report=
yes&reason=useless
Delete: non-english         -- http://mast
er.php.net/manage/user-notes.php?action=delete+61644&rep
ort=yes&reason=non-english
Delete: already in docs     -- http://
master.php.net/manage/user-notes.php?action=delete+61644&
;report=yes&reason=already+in+docs
Delete: other reasons       -- http://master.php.net/manage/user-
notes.php?action=delete+61644&report=yes
Reject      -- http://master.php.net/manage/user-
notes.php?action=reject+61644&report=yes
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61644 modified in ref.mail by didou
user name
2006-04-17 13:32:28
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...
<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
  $eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
  $eol="\r"; 
} else {
  $eol="\n"; 
} ?>

<?php
# File for Attachment
$f_name="../../letters/".$letter;    // use
relative path OR ELSE big headaches. $letter is my file for
attaching.
$handle=fopen($f_name, 'rb');
$f_contents=fread($handle, filesize($f_name));
$f_contents=chunk_split(base64_encode($f_contents));   
//Encode The Data For Transition using base64_encode();
$f_type=filetype($f_name);
fclose($handle);
# To Email Address
$emailaddress="himher.com";
# Message Subject
$emailsubject="Heres An Email with a
PDF".date("Y/m/d H:i:s");
# Message Body
ob_start();
  require("emailbody.php");     // i made a
simple & pretty page for showing in the email
$body=ob_get_contents(); ob_end_clean();

# Common Headers
$headers .= 'From: Jonny <jongenius.com>'.$eol;
$headers .= 'Reply-To: Jonny <jongenius.com>'.$eol; 
$headers .= 'Return-Path: Jonny <jongenius.com>'.$eol;     // these two to set reply
address
$headers .= "Message-ID: <".$now."
TheSystem".$_SERVER['SERVER_NAME'].">".
$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;
          // These two to help avoid spam-filters
# Boundry for marking the split & Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol; 
$headers .= "Content-Type: multipart/related;
boundary=\"".$mime_boundary."\"&q
uot;.$eol; 
$msg = "";

# Attachment
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: application/pdf;
name=\"".$letter."\"".$eol; 
 // sometimes i have to send MS Word, use 'msword' instead
of 'pdf'
$msg .= "Content-Transfer-Encoding:
base64".$eol;
$msg .= "Content-Disposition: attachment;
filename=\"".$letter."\"".$e
ol.$eol; // !! This line needs TWO end of lines !! IMPORTANT
!!
$msg .= $f_contents.$eol.$eol;
# Setup for text OR html
$msg .= "Content-Type:
multipart/alternative".$eol; 

# Text Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/plain;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= "This is a multi-part message in MIME
format.".$eol;
$msg .= "If you are reading this, please update your
email-reading-software.".$eol;
$msg .= "+ + Text Only Email from Genius Jon +
+".$eol.$eol;

# HTML Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= $body.$eol.$eol;

# Finished
$msg .=
"--".$mime_boundary."--".$eol.$eol; 
 // finish with two eol's for better security. see
Injection.

# SEND THE EMAIL
ini_set(sendmail_from,'fromme.com');  // the INI
lines are to force the From Address to be used !
  mail($emailaddress, $emailsubject, $msg, $headers); 
ini_restore(sendmail_from);
?>

I hope this helps.
Jon Webb [Madrid&bond]

--was--
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...
<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')):
$eol="\r\n"; elseif
(strtoupper(substr(PHP_OS,0,3)=='MAC')):
$eol="\r"; else: $eol="\n"; endif;
?>

<?php
# File for Attachment
$f_name="../../letters/".$letter;    // use
relative path OR ELSE big headaches. $letter is my file for
attaching.
$handle=fopen($f_name, 'rb');
$f_contents=fread($handle, filesize($f_name));
$f_contents=chunk_split(base64_encode($f_contents));   
//Encode The Data For Transition using base64_encode();
$f_type=filetype($f_name);
fclose($handle);
# To Email Address
$emailaddress="himher.com";
# Message Subject
$emailsubject="Heres An Email with a
PDF".date("Y/m/d H:i:s");
# Message Body
ob_start();
  require("emailbody.php");     // i made a
simple & pretty page for showing in the email
$body=ob_get_contents(); ob_end_clean();

# Common Headers
$headers .= 'From: Jonny <jongenius.com>'.$eol;
$headers .= 'Reply-To: Jonny <jongenius.com>'.$eol; 
$headers .= 'Return-Path: Jonny <jongenius.com>'.$eol;     // these two to set reply
address
$headers .= "Message-ID: <".$now."
TheSystem".$_SERVER['SERVER_NAME'].">".
$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;
          // These two to help avoid spam-filters
# Boundry for marking the split & Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol; 
$headers .= "Content-Type: multipart/related;
boundary=\"".$mime_boundary."\"&q
uot;.$eol; 
$msg = "";

# Attachment
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: application/pdf;
name=\"".$letter."\"".$eol; 
 // sometimes i have to send MS Word, use 'msword' instead
of 'pdf'
$msg .= "Content-Transfer-Encoding:
base64".$eol;
$msg .= "Content-Disposition: attachment;
filename=\"".$letter."\"".$e
ol.$eol; // !! This line needs TWO end of lines !! IMPORTANT
!!
$msg .= $f_contents.$eol.$eol;
# Setup for text OR html
$msg .= "Content-Type:
multipart/alternative".$eol; 

# Text Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/plain;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= "This is a multi-part message in MIME
format.".$eol;
$msg .= "If you are reading this, please update your
email-reading-software.".$eol;
$msg .= "+ + Text Only Email from Genius Jon +
+".$eol.$eol;

# HTML Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= $body.$eol.$eol;

# Finished
$msg .=
"--".$mime_boundary."--".$eol.$eol; 
 // finish with two eol's for better security. see
Injection.

# SEND THE EMAIL
ini_set(sendmail_from,'fromme.com');  // the INI
lines are to force the From Address to be used !
  mail($emailaddress, $emailsubject, $msg, $headers); 
ini_restore(sendmail_from);
?>

I hope this helps.
Jon Webb [Madrid&bond]

http://php.net/
manual/en/ref.mail.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61644 modified in ref.mail by colder
user name
2006-05-31 17:53:20
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...

<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
  $eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
  $eol="\r"; 
} else {
  $eol="\n"; 
} ?>

<?php
# File for Attachment
$f_name="../../letters/".$letter;    // use
relative path OR ELSE big headaches. $letter is my file for
attaching.
$handle=fopen($f_name, 'rb');
$f_contents=fread($handle, filesize($f_name));
$f_contents=chunk_split(base64_encode($f_contents));   
//Encode The Data For Transition using base64_encode();
$f_type=filetype($f_name);
fclose($handle);
# To Email Address
$emailaddress="himher.com";
# Message Subject
$emailsubject="Heres An Email with a
PDF".date("Y/m/d H:i:s");
# Message Body
ob_start();
  require("emailbody.php");     // i made a
simple & pretty page for showing in the email
$body=ob_get_contents(); ob_end_clean();

# Common Headers
$headers .= 'From: Jonny <jongenius.com>'.$eol;
$headers .= 'Reply-To: Jonny <jongenius.com>'.$eol; 
$headers .= 'Return-Path: Jonny <jongenius.com>'.$eol;     // these two to set reply
address
$headers .= "Message-ID: <".$now."
TheSystem".$_SERVER['SERVER_NAME'].">".
$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;
          // These two to help avoid spam-filters
# Boundry for marking the split & Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol; 
$headers .= "Content-Type: multipart/related;
boundary=\"".$mime_boundary."\"&q
uot;.$eol; 
$msg = "";

# Attachment
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: application/pdf;
name=\"".$letter."\"".$eol; 
 // sometimes i have to send MS Word, use 'msword' instead
of 'pdf'
$msg .= "Content-Transfer-Encoding:
base64".$eol;
$msg .= "Content-Disposition: attachment;
filename=\"".$letter."\"".$e
ol.$eol; // !! This line needs TWO end of lines !! IMPORTANT
!!
$msg .= $f_contents.$eol.$eol;
# Setup for text OR html
$msg .= "Content-Type:
multipart/alternative".$eol; 

# Text Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/plain;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= "This is a multi-part message in MIME
format.".$eol;
$msg .= "If you are reading this, please update your
email-reading-software.".$eol;
$msg .= "+ + Text Only Email from Genius Jon +
+".$eol.$eol;

# HTML Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= $body.$eol.$eol;

# Finished
$msg .=
"--".$mime_boundary."--".$eol.$eol; 
 // finish with two eol's for better security. see
Injection.

# SEND THE EMAIL
ini_set(sendmail_from,'fromme.com');  // the INI
lines are to force the From Address to be used !
  mail($emailaddress, $emailsubject, $msg, $headers); 
ini_restore(sendmail_from);
?>


I hope this helps.
Jon Webb [Madrid&bond]

--was--
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...




I hope this helps.
Jon Webb [Madrid&bond]

http://php.net/
manual/en/ref.mail.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61644 modified in ref.mail by colder
user name
2006-05-31 17:52:04
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...




I hope this helps.
Jon Webb [Madrid&bond]

--was--
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...
<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
  $eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
  $eol="\r"; 
} else {
  $eol="\n"; 
} ?>



I hope this helps.
Jon Webb [Madrid&bond]

http://php.net/
manual/en/ref.mail.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61644 modified in ref.mail by colder
user name
2006-05-31 17:51:33
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...
<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
  $eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
  $eol="\r"; 
} else {
  $eol="\n"; 
} ?>



I hope this helps.
Jon Webb [Madrid&bond]

--was--
Corrupted Attachments ???
I spent many hours with corrupted attachments (of all types
of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.

i work with many different systems, so...
<?php # Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
  $eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
  $eol="\r"; 
} else {
  $eol="\n"; 
} ?>

<?php
# File for Attachment
$f_name="../../letters/".$letter;    // use
relative path OR ELSE big headaches. $letter is my file for
attaching.
$handle=fopen($f_name, 'rb');
$f_contents=fread($handle, filesize($f_name));
$f_contents=chunk_split(base64_encode($f_contents));   
//Encode The Data For Transition using base64_encode();
$f_type=filetype($f_name);
fclose($handle);
# To Email Address
$emailaddress="himher.com";
# Message Subject
$emailsubject="Heres An Email with a
PDF".date("Y/m/d H:i:s");
# Message Body
ob_start();
  require("emailbody.php");     // i made a
simple & pretty page for showing in the email
$body=ob_get_contents(); ob_end_clean();

# Common Headers
$headers .= 'From: Jonny <jongenius.com>'.$eol;
$headers .= 'Reply-To: Jonny <jongenius.com>'.$eol; 
$headers .= 'Return-Path: Jonny <jongenius.com>'.$eol;     // these two to set reply
address
$headers .= "Message-ID: <".$now."
TheSystem".$_SERVER['SERVER_NAME'].">".
$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;
          // These two to help avoid spam-filters
# Boundry for marking the split & Multitype Headers
$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol; 
$headers .= "Content-Type: multipart/related;
boundary=\"".$mime_boundary."\"&q
uot;.$eol; 
$msg = "";

# Attachment
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: application/pdf;
name=\"".$letter."\"".$eol; 
 // sometimes i have to send MS Word, use 'msword' instead
of 'pdf'
$msg .= "Content-Transfer-Encoding:
base64".$eol;
$msg .= "Content-Disposition: attachment;
filename=\"".$letter."\"".$e
ol.$eol; // !! This line needs TWO end of lines !! IMPORTANT
!!
$msg .= $f_contents.$eol.$eol;
# Setup for text OR html
$msg .= "Content-Type:
multipart/alternative".$eol; 

# Text Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/plain;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= "This is a multi-part message in MIME
format.".$eol;
$msg .= "If you are reading this, please update your
email-reading-software.".$eol;
$msg .= "+ + Text Only Email from Genius Jon +
+".$eol.$eol;

# HTML Version
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html;
charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= $body.$eol.$eol;

# Finished
$msg .=
"--".$mime_boundary."--".$eol.$eol; 
 // finish with two eol's for better security. see
Injection.

# SEND THE EMAIL
ini_set(sendmail_from,'fromme.com');  // the INI
lines are to force the From Address to be used !
  mail($emailaddress, $emailsubject, $msg, $headers); 
ini_restore(sendmail_from);
?>

I hope this helps.
Jon Webb [Madrid&bond]

http://php.net/
manual/en/ref.mail.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61644 modified in ref.mail by colder
user name
2006-05-31 18:21:44
Preview before you make the changes... 

-Hannes

On 5/31/06, colderphp.net <colderphp.net> wrote:
> Corrupted Attachments ???
> I spent many hours with corrupted attachments (of all
types of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
> Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.
>
> i work with many different systems, so...
>
> <?php # Is the OS Windows or Mac or Linux
> if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
>   $eol="\r\n";
> } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
>   $eol="\r";
> } else {
>   $eol="\n";
> } ?>
>
> <?php
> # File for Attachment
> $f_name="../../letters/".$letter;    // use
relative path OR ELSE big headaches. $letter is my file for
attaching.
> $handle=fopen($f_name, 'rb');
> $f_contents=fread($handle, filesize($f_name));
> $f_contents=chunk_split(base64_encode($f_contents));   
//Encode The Data For Transition using base64_encode();
> $f_type=filetype($f_name);
> fclose($handle);
> # To Email Address
> $emailaddress="himher.com";
> # Message Subject
> $emailsubject="Heres An Email with a
PDF".date("Y/m/d H:i:s");
> # Message Body
> ob_start();
>   require("emailbody.php");     // i made a
simple & pretty page for showing in the email
> $body=ob_get_contents(); ob_end_clean();
>
> # Common Headers
> $headers .= 'From: Jonny <jongenius.com>'.$eol;
> $headers .= 'Reply-To: Jonny <jongenius.com>'.$eol;
> $headers .= 'Return-Path: Jonny <jongenius.com>'.$eol;     // these two to set reply
address
> $headers .= "Message-ID: <".$now."
TheSystem".$_SERVER['SERVER_NAME'].">".
$eol;
> $headers .= "X-Mailer: PHP
v".phpversion().$eol;           // These two to help
avoid spam-filters
> # Boundry for marking the split & Multitype Headers
> $mime_boundary=md5(time());
> $headers .= 'MIME-Version: 1.0'.$eol;
> $headers .= "Content-Type: multipart/related;
boundary=\"".$mime_boundary."\"&q
uot;.$eol;
> $msg = "";
>
> # Attachment
> $msg .= "--".$mime_boundary.$eol;
> $msg .= "Content-Type: application/pdf;
name=\"".$letter."\"".$eol; 
 // sometimes i have to send MS Word, use 'msword' instead
of 'pdf'
> $msg .= "Content-Transfer-Encoding:
base64".$eol;
> $msg .= "Content-Disposition: attachment;
filename=\"".$letter."\"".$e
ol.$eol; // !! This line needs TWO end of lines !! IMPORTANT
!!
> $msg .= $f_contents.$eol.$eol;
> # Setup for text OR html
> $msg .= "Content-Type:
multipart/alternative".$eol;
>
> # Text Version
> $msg .= "--".$mime_boundary.$eol;
> $msg .= "Content-Type: text/plain;
charset=iso-8859-1".$eol;
> $msg .= "Content-Transfer-Encoding:
8bit".$eol;
> $msg .= "This is a multi-part message in MIME
format.".$eol;
> $msg .= "If you are reading this, please update
your email-reading-software.".$eol;
> $msg .= "+ + Text Only Email from Genius Jon +
+".$eol.$eol;
>
> # HTML Version
> $msg .= "--".$mime_boundary.$eol;
> $msg .= "Content-Type: text/html;
charset=iso-8859-1".$eol;
> $msg .= "Content-Transfer-Encoding:
8bit".$eol;
> $msg .= $body.$eol.$eol;
>
> # Finished
> $msg .=
"--".$mime_boundary."--".$eol.$eol; 
 // finish with two eol's for better security. see
Injection.
>
> # SEND THE EMAIL
> ini_set(sendmail_from,'fromme.com');  // the INI
lines are to force the From Address to be used !
>   mail($emailaddress, $emailsubject, $msg, $headers);
> ini_restore(sendmail_from);
> ?>
>
>
> I hope this helps.
> Jon Webb [Madrid&bond]
>
> --was--
> Corrupted Attachments ???
> I spent many hours with corrupted attachments (of all
types of files) - The answer: a blank line is needed after
$msg.=$file \r\n \r\n [incredible but true].
> Heres some useful code for sending an attachment, and
display html OR text depending on the users email-reader.
>
> i work with many different systems, so...
>
>
>
>
> I hope this helps.
> Jon Webb [Madrid&bond]
>
> http://php.net/
manual/en/ref.mail.php
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php
>
>

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )