Connecting Tech Pros Worldwide Help | Site Map

Send an email with HTML

Thierry
Guest
 
Posts: n/a
#1: Oct 27 '05
Hello.

Is it possible to send an email with some HTML code ?

I tried the following code, where $msg == '<html><body>... blah blab
blah etc.</body></html>' :

// Adresse de l'expediteur
$entete = "From: $from \n";

// Copie du message
$entete .= "Cc: $cc \n";

// Copie cachée
$entete .= "Bcc: $bcc \n";

// Adresse de réponse
$entete .= "Reply-To: $from \n";
$entete .= 'X-Mailer: PHP/' . phpversion() . '\n';

// On peut ajouter ses propres en-tête
$entete .= 'X-CeQueVousVoulez: Contact EASYJOKE \n';

// Type MIME
$entete .= 'Content-Type: text/plain; charset=iso-8859-1 \n';

// Encodage
$entete .= 'Content-Transfer-Encoding: 8bit \n';

mail($to, $subject, $msg, $entete);


Any help would be welcome...
Thx Titi

Malcolm Dew-Jones
Guest
 
Posts: n/a
#2: Oct 27 '05

re: Send an email with HTML


Thierry (abuse@microsoft.com) wrote:
: Hello.

: Is it possible to send an email with some HTML code ?

The header of the mail message needs "Content-type: text/html"

Of course you understand that that header is also used by many mail
filters to reject unwanted mail.


--

This programmer available for rent.
Thierry
Guest
 
Posts: n/a
#3: Oct 27 '05

re: Send an email with HTML


Malcolm Dew-Jones a écrit :[color=blue]
> Thierry (abuse@microsoft.com) wrote:
> : Hello.
>
> : Is it possible to send an email with some HTML code ?
>
> The header of the mail message needs "Content-type: text/html"
>
> Of course you understand that that header is also used by many mail
> filters to reject unwanted mail.[/color]


But I need something that will not be rejected :-(

Malcolm Dew-Jones
Guest
 
Posts: n/a
#4: Oct 28 '05

re: Send an email with HTML


Thierry (abuse@microsoft.com) wrote:
: Malcolm Dew-Jones a écrit :
: > Thierry (abuse@microsoft.com) wrote:
: > : Hello.
: >
: > : Is it possible to send an email with some HTML code ?
: >
: > The header of the mail message needs "Content-type: text/html"
: >
: > Of course you understand that that header is also used by many mail
: > filters to reject unwanted mail.


: But I need something that will not be rejected :-(

I forgot to add, you also need "MIME-Version: 1.0" in the header.

If you send html mail then people who reject html mail will reject it. I
don't know what percentage that is, but I think it is non trivial though
well less than the majority.

If you don't want them to reject your mail then send text instead.

Spam filters will typically increase the spam rating for html mail, which
may or may not cause it to be rejected. More people (%-wise) use spam
filters than those that simply reject html mail, it may well be the
majority now.

If you don't want a spam filter to reject your mail then be careful not to
send spam, or things that look like spam. Be careful to stay off various
blocking lists, and don't send large volumes of similar looking mail
unless it's a bona fide sign-up mail list.


--

This programmer available for rent.
Tim Roberts
Guest
 
Posts: n/a
#5: Oct 29 '05

re: Send an email with HTML


Thierry <abuse@microsoft.com> wrote:
[color=blue]
>Malcolm Dew-Jones a écrit :[color=green]
>> Thierry (abuse@microsoft.com) wrote:
>> : Hello.
>>
>> : Is it possible to send an email with some HTML code ?
>>
>> The header of the mail message needs "Content-type: text/html"
>>
>> Of course you understand that that header is also used by many mail
>> filters to reject unwanted mail.[/color]
>
>But I need something that will not be rejected :-([/color]

"Many" is an exaggeration. A few zealots do reject mail that is HTML-only.

The more acceptable method is to include both an HTML part and a plain
part.

Subject: This is my message
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="____separator____"

This section is only read by mail readers that do not understand MIME.

--____separator____
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

This is the plain text section.

--____separator____
Content-Type: text/html
Content-Transfer-Encoding: 8bit

<html><body><h1>This is the <i>HTML</i> section.</h1></body></html>

--____separator____--
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Geoff Berrow
Guest
 
Posts: n/a
#6: Oct 30 '05

re: Send an email with HTML


Message-ID: <57k7m1ph56ndkrfatst7f0r4d154plg4tq@4ax.com> from Tim
Roberts contained the following:
[color=blue]
>"Many" is an exaggeration. A few zealots do reject mail that is HTML-only.[/color]

I reject it and I wouldn't call myself a zealot. I had a mail today
saying I had received a postcard from a family member. It contained the
following lines:
....
<p align="left"><font size="2" face="Arial"><A
href="http://sex.idilis.ro/postcard.exe"
target=_blank>http://www2.postcards.org/?a91-valets-cloud-31337</A></font></p>
....

Says it all really.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Closed Thread