[thelist] Sending Tabular data with mail()

Santilal Parbhu santilal at scorpioneng.co.nz
Sat May 24 02:01:21 CDT 2008


Thanks Chris,

This just goes to show how little I know about how emails are structured.
Where do you find out about this sort of stuff.

Your solution looks promising.  I take it from your example that you have
two sections: text and html.  The boundary separates the parts.  The
"\r\n----knabecnarusni\r\n" separates the two sections.  

Now, two questions:

Do you have to have "\r\n----knabecnarusni\r\n" at the beginning and end of
each section, and

What exactly is "\r\n----knabecnarusni\r\n" is it something you just made up
or does knabecnarusni mean something.

Thanks for the help.

Santilal

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Chris Price
Sent: Friday, 23 May 2008 3:05 a.m.
To: thelist at lists.evolt.org
Subject: Re: [thelist] Sending Tabular data with mail()

Jeffrey Barke wrote:
> Santilal,
>
> PHP's mail function sends a plain text email, not an HTML one, so no  
> markup is necessary or will work.
There's nothing stopping you sending html emails using php's mail() 
function but you have to send it multipart.

I set a system up for doing this some years ago and it was rather crude 
but it worked. It looked something like this:

$subject = "myCompany Quotation";
$to = $emailTo[$value];

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; 
boundary=\"--knabecnarusni\"";
$headers .= "\r\nReturn-Path: <enquiries at myDomain.co.uk>\r\n";
$headers .= "From: myCompany<enquiry at myDomain.co.uk>\r\n";
$headers .= "Reply-to: enquiries<enquiries at myDomain.co.uk>";

$message = "This is a multi-part message in MIME format. \r\n";
$message .= "\r\n----knabecnarusni\r\n";
$message .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";
$message .= "Content-Transfer-Encoding: 7bit \r\n\r\n";

$message .= "Quotation from myDomain.co.uk \r\n";
$message .= "For: $emailForename[$value] $emailSurname[$value] \r\n\r\n";
$message .= "Thank you for using myCompany. A summary of your recent 
enquiry and quotation is listed below: \r\n\r\n";

\/
\/

$message .= "\r\n----knabecnarusni\r\n";
$message .= "Content-Type: text/html; charset=iso-8859-1 \r\n";
$message .= "Content-Transfer-Encoding: 7bit \r\n\r\n";
$message .= "<html>\r\n";
$message .= "<body link='#003399' vlink='#003399' alink='#003399'>\r\n";
$message .= "<table cellspacing=0 cellpadding=4 border=0>\r\n";

$message .= "<tr>\r\n";
$message .= "<td><img 
src='http://www.myDomain.co.uk/email/images/myCompany.gif' 
alt='myCompany'></td>\r\n";
$message .= "<td align=right width='100%'><img 
src='http://www.myDomain.co.uk/email/images/myimage.gif' alt=''></td>\r\n";

$message .= "</td>\r\n";
$message .= "</tr>\r\n";
$message .= "</table>\r\n";
$message .= "</body>\r\n";
$message .= "</html>\r\n";

$message .= "\r\n----knabecnarusni--\r\n";


\/
\/

mail($To, $Subject, $Message, $Headers);

-- 

Kind Regards


  Chris Price
  Choctaw

chris.price at choctaw.co.uk <mailto:chris.price at choctaw.co.uk>
www.choctaw.co.uk <http://www.choctaw.co.uk>

Tel. 01524 825 245
Mob. 0777 451 4488

Beauty is in the Eye of the Beholder while
Excellence is in the Hand of the Professional

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 >> Sent on behalf of Choctaw Media Ltd <<

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Choctaw Media Limited is a company registered in
England and Wales with company number 04627649

Registered Office: Lonsdale Partners, Priory Close,
St Mary's Gate, Lancaster LA1 1XB . United Kingdom

-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 




More information about the thelist mailing list