f



Using mail() for HTML bodies.

Hi fellow

I read about this here, and I need a simple form to post and mail a
simple table (formatting) in HTML.
My message is somthing like: <html><body><table....

I have a header as this.

$headers =3D "From:".$_POST["v8"]."\r\n".
                "To:sonnich@--hot.ee\r\n".
                 "MIME-Version: 1.0\r\n" .
                 "Content-Type: text/html;\r\n";;
if (mail('sonnich@--hot.ee', 'T&auml;idetud ankeet', $message,
$headers))

My problems:
the body remains plain text in Outlook Express.
>From is not visible
The &auml; remains as is in the header (should be =E4)

Though my email is there twice, but the mail only once :-)

What do I dop wrong?

WBR
Sonnich

0
sonnich (155)
10/12/2007 9:36:25 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

4 Replies
768 Views

Similar Articles

[PageSpeed] 41

In our last episode,
<1192224985.050093.163490@v23g2000prn.googlegroups.com>, the lovely and
talented jodleren broadcast on comp.lang.php:

> Hi fellow

> I read about this here, and I need a simple form to post and mail a
> simple table (formatting) in HTML.
> My message is somthing like: <html><body><table....

> I have a header as this.

> $headers = "From:".$_POST["v8"]."\r\n".
>                 "To:sonnich@--hot.ee\r\n".
>                  "MIME-Version: 1.0\r\n" .
>                  "Content-Type: text/html;\r\n";;
> if (mail('sonnich@--hot.ee', 'T&auml;idetud ankeet', $message,
> $headers))

> My problems:
> the body remains plain text in Outlook Express.
>>From is not visible
> The &auml; remains as is in the header (should be �)

> Though my email is there twice, but the mail only once :-)

> What do I dop wrong?

Tried to put html in e-mail.  That is wrong.  It can be done, but it is a
good thing you don't know how.

-- 
Lars Eighner     <http://larseighner.com/>     <http://myspace.com/larseighner>
                         Countdown: 465 days to go.
                    What do you do when you're debranded?
0
usenet176 (216)
10/12/2007 9:45:27 PM
On 12/10/2007 in message 
<1192224985.050093.163490@v23g2000prn.googlegroups.com> jodleren wrote:

>My problems:
>the body remains plain text in Outlook Express.

It gets some things right then :-)

-- 
Jeff Gaines Damerham Hampshire UK
Indecision is the key to flexibility
0
10/12/2007 11:11:49 PM
jodleren wrote:
> Hi fellow
> 
> I read about this here, and I need a simple form to post and mail a
> simple table (formatting) in HTML.
> My message is somthing like: <html><body><table....
> 
> I have a header as this.
> 
> $headers = "From:".$_POST["v8"]."\r\n".
>                 "To:sonnich@--hot.ee\r\n".
>                  "MIME-Version: 1.0\r\n" .
>                  "Content-Type: text/html;\r\n";;
> if (mail('sonnich@--hot.ee', 'T&auml;idetud ankeet', $message,
> $headers))
> 
> My problems:
> the body remains plain text in Outlook Express.
>>From is not visible
> The &auml; remains as is in the header (should be �)
> 
> Though my email is there twice, but the mail only once :-)
> 

May I cordially request that the gurus cut the guy some slack.
While I agree that plain text is best, generally, sometimes for 
limited distribution html may be best.

For example, suppose that one needs to email a table to a 
computer-illiterate boss.... one, known recipient.

I suppose one could build a .pdf and send that, but it would seem 
that is overkill for a simple report to the boss.

bill
0
nobody22 (665)
10/13/2007 10:34:08 AM
bill wrote:
> jodleren wrote:
>> Hi fellow
>>
>> I read about this here, and I need a simple form to post and mail a
>> simple table (formatting) in HTML.
>> My message is somthing like: <html><body><table....
>>
>> I have a header as this.
>>
>> $headers = "From:".$_POST["v8"]."\r\n".
>>                 "To:sonnich@--hot.ee\r\n".
>>                  "MIME-Version: 1.0\r\n" .
>>                  "Content-Type: text/html;\r\n";;
>> if (mail('sonnich@--hot.ee', 'T&auml;idetud ankeet', $message,
>> $headers))
>>
>> My problems:
>> the body remains plain text in Outlook Express.
>>> From is not visible
>> The &auml; remains as is in the header (should be �)
>>
>> Though my email is there twice, but the mail only once :-)
>>
> 
> May I cordially request that the gurus cut the guy some slack.
> While I agree that plain text is best, generally, sometimes for limited 
> distribution html may be best.
> 
> For example, suppose that one needs to email a table to a 
> computer-illiterate boss.... one, known recipient.
> 
> I suppose one could build a .pdf and send that, but it would seem that 
> is overkill for a simple report to the boss.
> 
> bill
> 

Sorry, I agree with the others.  HTML email has too many problems.  It 
doesn't help to send it to the boss if he can't read it.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

0
jstucklex (14659)
10/13/2007 1:14:54 PM
Reply:

Similar Artilces:

Using Variables with Mail
I have a simple form on my website which is then processed by PHP to store the form data in a MySQL database and also email the form data to us in a formatted html table. It was working fine as a plain text email but since we've changed over to a html email with a table format none of the variables are coming across. For example we have: <?php // Pick up the form data and assign it to variables $firstname = $_POST['first_name']; $surname = $_POST['surname']; $email = $_POST['email']; $phone = $_POST['phone']; $comments = $_POST['comments']; and in the html email message body we have, for example: <td width="126"><span class="style1">First Name</span></td><td width="568"><span class="style8">$firstname</span></td> but when we receive the email it appears as: First Name $firstname instead of First Name: Simon We've obviously doing something wrong with the variables in the html email message body but can't see what we're doing wrong - anyone point us in the right direction? Many thanks - andrew Andrew Duncan wrote: > I have a simple form on my website which is then processed by PHP to store > the form data in a MySQL database and also email the form data to us in a > formatted html table. It was working fine as a plain text email but since > we've changed over to a html email with a table format ...

using mail to send html
anyone know how to use mail to send html content? i know it has to do with content-type but where do i specify it? On Thu, 25 Nov 2004 16:35:58 GMT, radioactiveman <radioactivem@springfield.com> wrote: >anyone know how to use mail to send html content? i know it has to do >with content-type but where do i specify it? > > > Why in the world would you *want* to? Html is for webpages, not for email. -- Joe Zeff The Guy With the Sideburns Bloody kids these days! - Give 'em a logic probe & they wouldn't know where to stick it. ...

html within php works, but php within html doesnt
Below are two different ways of writing the same script. The top one works but the bottom one displays nothing in the list. Can anyone see why? <?php echo "<select name='subcat' style='WIDTH: 95%'><option value=''>Select one</option>"; while($noticia = mysql_fetch_array($quer)) { echo "<option value='$noticia[TopicID]'>$noticia[Topic]</option>"; } echo "</select>"; ?> <select name="subcat" style="WIDTH: 95%"> <option value="">Select one</option> <?php while($noticia = mysql_fetch_array($quer)) { ?> <option value="<?php $noticia[TopicID]; ?>"><?php $noticia[Topic]; ?></option> <?php } ?> </select> Ian On Sat, 02 Sep 2006 13:19:38 GMT, "mantrid" <ian.dandav@virgin.net> wrote: ><option value="<?php $noticia[TopicID]; ?>"><?php $noticia[Topic]; >?></option> You haven't done anything in those PHP blocks; you need "print" or "echo". -- Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool DOOH! Knew it was somethin simple Cheers "Andy Hassall" <andy@andyh.co.uk> wrote in message news:gh1jf2dur1knluu2uf2mqj8r8shgu778ne@4ax.com... > On Sat, 02 Sep 2006 13:19:38 GMT, "mantrid" <ian....

mail error when using PHP
Howdy! I've encountered an odd error, and it seems to happen only when PHP is used to send email. I'm using PHP 4.1.2 on RH 7.1. The problem is best seen when OS Commerce generates email. Specifically, email that is sent to a local mailbox has the 'F' removed from the "From " header (I think this is the very first character in email messages). With the 'F' missing, the mail file is obviously corrupted. For now, I've resorted to using sed() and lockfile to fix it. When I had a little time some months ago, I spelunked through the OSC code; it seems the pr...

HTML body e-mail
Hello: it has been over a month !!!!. How can i send an e-mail with html body. Right now my application sends text format e-mails only. I am using VC++ 6.0 A sample code is really appreciated. Thank you. K1 "KEVIN" <keyvan_rahbaran@yahoo.com> wrote in message news:f6532895.0411091337.4e744c52@posting.google.com... > Hello: > > it has been over a month !!!!. How can i send an e-mail with html > body. Right now my application sends text format e-mails only. I am > using VC++ 6.0 > A sample code is really appreciated. > > Thank you. > > K1 Kevin, I don't know what particular object you are using, but look up CDONTS on the MSDN website. There are some attributes that need to be set for HTML vs. text-based email. I believe the default is text. Mike ...

Mail with HTML-body and pctures
I intend to compose and send an e-mail with a html body by use of PHP. The mail body is intended to consist of a html page. This html page uses a css-file, a background gif-file and a gif-picture. The result shows the html and its css- and gif-files all as separate attatchments. The html-file is shown without the intended enclosures and without application of the css. "Content-type: multipart/mixed" or "Content-type: multipart/related" in the header makes no difference. All the files are coded base64. "Content-type: text/html" for the html-file, &q...

attachments with HTML body PHP
I need to send an e-mail to people which contains a html body and has a pdf as an attachment. I have been abled to get each of these items working on their own but cannot put the two togthere. Here are my two closest attempts to getting it to work attempt 1 $cmd = "echo -e \"From:ME <postmaster@website.com>\nSubject: ".strip_tags($doc_title)."\nTo: $to_email\n\n " . html_message() . "\" | mutt -a $attach_path".$pdf_file_name . " -e 'my_hdr Content-Type: text/html' -H /dev/stdin"; this resulted in the following ...

how to use php to change this html?
Hello, I have this http://www.micro-active.com/osflv-test2.htm which shows 1 image and 4 videos and I hope to use php to change to a new set of 1 image and 4 videos. The user selects the "correct" video and then after that result is put into an array for sending to mysql, the next set of 1 image and 4 videos should be presented. Help please! Cheers, Geoff PS I do have this working using Javascript and createElement etc but it has been severely critized for being over complex! Geoff Cox wrote: > Hello, > > I have this > > http://www.micro-active.com/osflv-test2.htm > > which shows 1 image and 4 videos and I hope to use php to change to a > new set of 1 image and 4 videos. > > The user selects the "correct" video and then after that result is put > into an array for sending to mysql, the next set of 1 image and 4 > videos should be presented. > > Help please! > > Cheers, > > Geoff > > PS I do have this working using Javascript and createElement etc but > it has been severely critized for being over complex! As I told you when you asked before, Geoff. Create the static html for both pages. Look at what's the same and what's different. That which is the same is just html. That which is different needs to be generated by PHP. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ======...

using PHP to parse through HTML
Hi, I'm using PHP 4 and trying to parse through HTML to look for HREF attributes of anchor tags and SRC attributes of IMG tags. Does anyone know of any libraries/freeware to help parse through HTML to find these things. Right now, I'm doing a lot of "strstr" calls, but there is probably a better way to do what I need. Thanks for any help, - Dave On 19 Feb 2005 11:49:24 -0800, laredotornado@gmail.com wrote: >Hi, I'm using PHP 4 and trying to parse through HTML to look for HREF >attributes of anchor tags and SRC attributes of IMG tags. Does anyone >know of any libraries/freeware to help parse through HTML to find these >things. Right now, I'm doing a lot of "strstr" calls, but there is >probably a better way to do what I need. Haven't used it myself, but seen mentions of: http://pear.php.net/package/XML_HTMLSax ... which looks possibly suitable from the description on the page. -- Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool laredotornado@gmail.com wrote in news:1108842564.846225.81750@c13g2000cwb.googlegroups.com: > Hi, I'm using PHP 4 and trying to parse through HTML to look for HREF > attributes of anchor tags and SRC attributes of IMG tags. Does anyone > know of any libraries/freeware to help parse through HTML to find these > things. Right now, I'm doing a lot of "strstr...

HTML mail using sendmail
I am trying to use sendmail to send an HTML email. Is there something special in the header to let the email client know that it is an html file? I am creating a flat file with all the required information but when I put in the body of the email (Html) it just sends the html commands and that is what is displayed in the email. Not the pictures etc. I want displayed. Here is a copy of what I am sending to send mail: From: sales@my-domain.com To: rthomas@my-domain.com Cc: Bcc: Subject: New User Registration <html> <head> <title>New User Registration</title> <l...

using php mail to forward email?
Hello, user@x.com receives an email from user@a.com. I want to forward that email to user@y.com. I want the contents/header to remain intact, with the exception of adding "X-Forwarded-For". In other words, when user@y.com received the email, it will be from user@a.com, but will contain a reference that it was forwarded by user@x.com. I'm piping all email destined for user@x.com to a php script. I've seen some very complicated examples of using the mail function and I'm unsure how to use the mail function to do what I need. I'm relatively new to php so any advice is appreciated. Thank you, Craig. #!/usr/local/bin/php -q <?php // get email from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); // forward it to user@y.com // ??? ?> In our last episode, <9mvQi.22601$j7.428084@news.indigo.ie>, the lovely and talented Craig Hurley broadcast on comp.lang.php: > Hello, > user@x.com receives an email from user@a.com. I want to forward that > email to user@y.com. Why, exactly, don't you do that in your mail server? It's the right tool for this job. -- Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner> Countdown: 463 days to go. What do you do when you're debranded? On Oct 14, 5:08 pm, Lars Eighner <use...@larse...

HTML mail using sendmail #2
I am trying to use sendmail to send an HTML email. Is there something special in the header to let the email client know that it is an html file? I am creating a flat file with all the required information but when I put in the body of the email (Html) it just sends the html commands and that is what is displayed in the email. Not the pictures etc. I want displayed. Here is a copy of what I am sending to send mail: From: sales@my-domain.com To: rthomas@my-domain.com Cc: Bcc: Subject: New User Registration <html> <head> <title>New User Registration</title> <l...

RSS Feeds to HTML using PHP
Hi, I was trying to render a RSS feed using XSL. http://www.mmmec.org/portal/rss/feed5.xsl I used the following XSL file and was successfully able to render static XML pages. Click the following link:http://www.mmmec.org/portal/rss/test.xml Probably this will help you out. Now my problem arised when I tried to use PHP to do this for several feed dynamically. I used the same XML file. And I wrote a simple PHP code to fetch the file and output it. -------------------------------------------------------------------------------------------------------- <?php $xml = file_get_contents("ht...

PHP HTML Form mail question
Hi, I have recently added tried to update the feedback form on my page to be sent in HTML format. Problem is that when its submitted, I get the mail without the variable input, just the variable name. I have added the text version to it and both send fine, but still only the text version includes the variable input. HTML code taken directly from php.net example (See my form below). Can anyone advise how I can solve this ? -- Thanks, Wayne <?php $to = 'webmaster@mydomain.com'; $subject = 'www.mydomain.com - contact'; $message = ' <html> <head> <ti...

can you use html as value for php variable
Is there a way to use html as a value for a php variable while going in and out of the php tag? For example, can you do something like this? <?php $strHtml = ?> <p>somehtml here</p> <?php ; ?> so that the value of $strHtml equals "<p>somehtml here</p>" "KidBrax" <braxton.beyer@gmail.com> wrote in message news:1177605988.744898.320720@u32g2000prd.googlegroups.com... > Is there a way to use html as a value for a php variable while going > in and out of the php tag? > > For example, can you do something like this? >...

Use PHP to populate a Mailing list from a webpage
Hello, I am at PHP 101 level. I have a webpage that asks a user to enter their name in one box, email address in another and click send. That's works OK (almost):-). I also have created an empty Mailing list 'List-B' in my Mozilla Thunderbird to which I want to automatically add the email addresses sent from the webpage. Here's my question please. When the page gets back to my PHP pgm, can it add the email address to my mailing list without manual intervention? Am not fond of mixing languages, etc so a pure PHP solution would be appreciated unless design wi...

Question on using HTML within PHP documents
As some of you who helped with my "No input file selected" query earlier already know, I've just started a new job and am new to PHP. All the webpages are PHP, but contain HTML as a string definition. Which is actually nice and easy for me as I am an HTML specialist, but am a complete newbie with PHP. How inadvisable is it though? Here's what I mean: <?php define('NAVBAR_TITLE', 'Shipping'); define('HEADING_TITLE', 'Shipping'); define('TEXT_INFORMATION', ' <table width="90%" border="0" cellpadding=...

html e-mail seding problem with php...
Hi to all, I have the following html mail sender code written in php. It is working properly but my problem is, code doesn't send the text correctly which is in the varible "$mesaj". Code sends some unreadable text. Any help would be appreciated, Thanx all. Note: I put the sample image of the problem in: http://www.wiliw.com/problem2.gif Cem Louis <? $mesaj = "��i&#304;&#305;I&#351;&#350;&#287;&#286;"; $mailtext = "<html><head>"; $mailtext .= "<meta http-equiv=\"Content-Type\" content=\"text...

sending html email using php script
Hi, I am trying to send a html email from a php script. This script emails a common information to all the members in the database. The only problem is I cannot specify colors, hyperlinks etc..Html tags like <h1></h1>, <br/>, <b> etc works though.. Could any one tell me what i might be doing wrong? Any help will be greatly appreciated. Thanks, Ann Code: function mail_it($content, $subject, $email, $recipient) { global $attachment_chunk, $attachment_name, $attachment_type, $attachment_sent, $bcc; global $db; global $msgbody; $ob = "----=_OuterBounda...

How to send HTML as message body using SMTP
I need to send HTML formatted emails. I used the Report Generation Toolkit to build my HTML document and make sure I had all of the formatting right. Then I modified the Save Report To File.vi to also give me the HTML text string on an output connector and I wire this string to the message input on the SMTP Email Send Message.vi. I receive the email OK, but all I see is the HTML code in the message body. What can I do to make sure that the email displays the message correctly. I use Outlook and I know it will receive and display HTML emails, I get them all the time. I would appreciate any help. Hi, your problem is that "SMTP Email Send Message.vi" send message as MINE content-type "text/plain". You must change this MINE content-type to "text/html" type. You can change this value permanent in "SMTP Email MIME Text Content-Type.vi" or you can creat new control "MINE content-type" and take it out to "SMTP Email Send Message.vi". [after care for char '\n' on the end of new control "MINE content-type" string - you must delete it] Good luck. JCC JCC, Thanks for the help. That worked perfectly. One more question. Can I send embedded jpg or gif images in an HTML formatted email? Thanks again, dgw ...

howto send html mails using smtplib
Hi, I have the following problem: 1) I can use smtplib to send text messages 2) I can generate html 3) I want to email the html and want it to be seen by the email client as html. However, when I receive the message, the email client displays it as text (code hereunder) - I assume it has to do with the MIMEText call but since I cannot see any MIMEhtml ..... Any clue ? Thanks Philippe #******************************************************************** def Mail(self,p_data): you = wx.GetTextFromUser('EMAIL ADDRESS','ID') if len(you) == 0: ...

How to share/use a variable between PHP and HTML on the same page ?
How to share/use a variable between PHP and HTML on the same page ? ( i.e. without using GET/ POST etc.... ) Is it possible ? And what about same with PHP and JavaScript ? On Nov 19, 8:40 am, pradnya <pdu...@gmail.com> wrote: > How to share/use a variable between PHP and HTML on the same page ? > ( i.e. without using GET/ POST etc.... ) > > Is it possible ? > > And what about same with PHP and JavaScript ? You can share through from PHP to HTML just one way (server->client) through a hidden input field Example: <INPUT TYPE="hidden" NAME="htmlvar" value=<?php echo $phpvar ?> /> For Javascript it is then possible to access it. For two way communication you should really look into AJAX/ JSON principles pradnya wrote: > How to share/use a variable between PHP and HTML on the same page ? > ( i.e. without using GET/ POST etc.... ) > > Is it possible ? Not sure what you mean. HTML doesn't have "variables". > And what about same with PHP and JavaScript ? Depending on what you want to achieve there are several techniques. You can use PHP to generate the Javascript in the first place, which allows PHP to populate the script's variables with certain values. Or a piece of Javascript can communicate with a PHP script using AJAX. -- Toby A Inkster BSc (Hons) ARCS [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux] [OS: Linux 2.6.12-12mdksmp, up 12 days, 15:35.] US...

mailing in html mode (using mutt and Blogger)
So I'm trying to post blogs in Blogger from mutt. All was going well- easy integration (blogger is a nice tool, btw). BUT if i write html codes (to control formatting from the mutt end), blogger escapes them (replaces "<" with "& l t ;") now reading the blogger documentation, the problem is clear: http://help.blogger.com/bin/answer.py?answer=%201149 says: There are two formats that emails generally use: plain text and HTML. Many email clients will have an option to switch between the two modes. In HTML mode, all HTML is interpreted as HTML....

E-mail client capable of using html templates?
Hello, I'm fairly new to Mac and as much as I'm absolutely growing fond of OSX, I must admit I was rather disappointed when I discovered that something I had done for ages on Windows seemed impossible on Mac. Or am I wrong? The problem? I regularly create html-files like company newsletters or teaser e-mail campaigns and used to send them out as Stationery in Microsoft Outlook. When I switched to Mac, I chose not to work with Entourage as my default mail client and am working with Mail. But this program nor any other freeware client I've downloaded and tried supports th...

Web resources about - Using mail() for HTML bodies. - comp.lang.php

Bodie Broadus - Wikipedia, the free encyclopedia
Preston "Bodie" Broadus is a fictional character on the HBO drama The Wire , played by actor J. D. Williams . Bodie is initially a rough, low-level ...

Search Twitter - bodies found
Log in Sign up Search Refresh Top news story Sky News @ SkyNews 5h Bodies Found In AirAsia Missing Plane Search news.sky.com/story/1399627/… ...

See what guns do to the bodies of innocent children, teachers, psychologists and school administrators ...
... scene, with dummies, fake blood, scattered body parts. Including the gunman. Everyone can come for a visit to see what guns do to the bodies ...

My Conversation with Michael Moss: Bullies, Bodies, and the Body Politic
... whose work on addictive junk food graced the cover of the paper’s magazine this week. Alas, My Conversation with Michael Moss: Bullies, Bodies, ...

Methodist Church, Bodie, California - Flickr - Photo Sharing!
Bodie is a ghost town in the Bodie Hills east of the Sierra Nevada mountain range in Mono County, California, United States, about 75 miles (120 ...

Raw: International Team Inspects MH17 Bodies - YouTube
Subscribe for more Breaking News: http://smarturl.it/AssociatedPress A team of international monitors on Monday inspected refrigerated railcars ...

Baby Asha: Protesters vow to put bodies on the line to prevent baby's offshore removal
Protesters rallying in support of baby Asha say they will put themselves in front of cars to prevent her from being deported to Nauru.

Travis Vader Trial Shines Light On Murder Cases Without Bodies 0
Prosecutors have an uphill task. EDMONTON — Legal experts say murder cases without bodies are unusual and it's even more rare for them to go ...

Two bodies found, boat capsized on San Jacinto River
We&#39;re hearing from the Coast Guard that a boat has capsized on the San Jacinto River and a rescue helicopter is over the scene.

Lane Bryant's CMO Talks Barbie, Bodies and Branding
Earlier this week, TV ads for a new campaign from plus-size retailer Lane Bryant were reportedly rejected for raciness by networks including ...

Resources last updated: 3/23/2016 7:24:45 PM