473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Send an email with HTML

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

Oct 27 '05 #1
5 2312
Thierry (ab***@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.
Oct 27 '05 #2
Malcolm Dew-Jones a écrit :
Thierry (ab***@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 :-(

Oct 27 '05 #3
Thierry (ab***@microsoft.com) wrote:
: Malcolm Dew-Jones a écrit :
: > Thierry (ab***@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.
Oct 27 '05 #4
Thierry <ab***@microsoft.com> wrote:
Malcolm Dew-Jones a écrit :
Thierry (ab***@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 :-(


"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, ti**@probo.com
Providenza & Boekelheide, Inc.
Oct 29 '05 #5
Message-ID: <57********************************@4ax.com> from Tim
Roberts contained the following:
"Many" is an exaggeration. A few zealots do reject mail that is HTML-only.


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/
Oct 30 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Google Mike | last post by:
I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to...
1
by: Kenshin | last post by:
Hey! I have another script where i pull all the information from the database and I want to send it to the person. What they do is they enter in their email, and if the email matches, than it will...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
2
by: David Lozzi | last post by:
Howdy, I'm new to .Net 2.0... Getting "System.Net.Mail.SmtpException: The operation has timed out" on this script at the smtpClient.Send(msg) line Dim msg As New MailMessage
2
by: Malli mindwave | last post by:
Hi, We are using the yahoowebHostiing service for my company website, In that one screen of the SendComments/FeedBack section is there, I'm basically dot.net develeoper ,but yahoowebhosting not...
2
by: kennykenn | last post by:
Hi, Ive producd code to send an email after capturing info off a form,it works fine locally but when i put it live it doesnt work! the code is stopin at 'msg.send' any ideas, here the code! ...
6
by: =?Utf-8?B?TMOhemFybw==?= | last post by:
Hi everyone I've a simple ASP.NET Page that send a email using smtclient. The server is a Exchange and use my credentials to autentificated. The problem is that the send mail appear in the...
3
digicrowd
by: digicrowd | last post by:
http://bytes.com/images/howtos/applemail_sig_icon.jpg You can make your emails fancy in Mail.app by using Rich Text formatting or even included Stationery. But, a simple way to send your own HTML...
2
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try
2
by: urbanedge | last post by:
I've just acquired a site and uploaded to godaddy and the email function won't work. I'm new to php and I'm not able to determine where the issue is. I've commented out $this->header .=...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.