473,503 Members | 8,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

html mail

HI,
I had been trying to send a html email from the folowing script that i
took from zend site and modified. Its working fine, but it sends some
garbage in the end of the mail.
I had posted this msg on the zend and other forums and also read this
forum with some similar msg. They talked about encoding I think there
is some problem in the encoding. I will be very thankful to someone
who can currect the script. Remember currect, I dont want to know what
am i Doing wrong this is because I am so tierd of trying them. Please
I will be thankful, I understand that i should learn where am I going
wrong but I tried all suggestions may be I am not doing it the right
way. I will be thankful if someone can currect it or mail me the
similar script that works fine to sm***********@hotpop.com.

Regards
Jaunty

<?

$headers = "From: we*******@myhost.net\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLDEMO");
$headers .= "Content-Type: multipart/alternative" . "; boundary =
$boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";
$headers .= "--$boundary\r\n" . "Content-Type: text/plain;
charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("This is the plain text
version!"));
$headers .= "--$boundary\r\n" . "Content-Type: text/html;
charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$name = stripslashes($HTTP_POST_VARS['name']);
$email = stripslashes($HTTP_POST_VARS['email']);
$msg = "<b>Name:</b> " .
$name . "\nEMail: " . $email;

$headers .= chunk_split(base64_encode("$msg"));
$sent = @mail('Mr. Jaunty<me@myemail.net>', 'Msg From My Website' ,
$msg , $headers);
if($sent == true) {
header('Location: send.htm');
}
if($sent == false) {
header('Location: notsend.htm');
}

?>
Jul 17 '05 #1
2 1417
Hello,

On 07/14/2004 08:11 PM, Jaunty Edward wrote:
HI,
I had been trying to send a html email from the folowing script that i
took from zend site and modified. Its working fine, but it sends some
garbage in the end of the mail.
I had posted this msg on the zend and other forums and also read this
forum with some similar msg. They talked about encoding I think there
is some problem in the encoding. I will be very thankful to someone
who can currect the script. Remember currect, I dont want to know what
am i Doing wrong this is because I am so tierd of trying them. Please
I will be thankful, I understand that i should learn where am I going
wrong but I tried all suggestions may be I am not doing it the right
way. I will be thankful if someone can currect it or mail me the
similar script that works fine to sm***********@hotpop.com.


It seems you are mistaking the message headers and body data.

Anyway the example in the Zend site encourages you to a bad practice
that may make your messages end up being discarded by spam filters.

HTML messages should always have an alternative text part that is
displayed for people with HTML capable mail programs. Without an
alternative text part the message does not look like it was sent by a
user using a real mail client, and so less tolerant spam filters discard it.

The correct way to do it is to compose multipart/alternative. If you
want to know how to send such messages without much effort, you may want
to tr this class that even comes with an example on how to compose and
send HTML messages properly:

http://www.phpclasses.org/mimemessage
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #2
HI,
thanks for the help, I got a script that works fine, if any one is
future want a script for mail me i will mail you.
Thanks
Jaunty
Jul 17 '05 #3

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

Similar topics

5
2569
by: Ian N | last post by:
Hi, I'm creating a site that posts orders to an email address when they're submitted, these orders need to be in the form of official invoices so i'm using HTML to format them. I already have...
0
9857
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
8
5274
by: LRW | last post by:
I'm not sure this message is totally appropriate for this group, so please, if anyone has a better group suggestion, let me know! My company sends out a monthly newsletter in HTML format to our...
3
481
by: T.Michelle | last post by:
We have few Mail templates (.html) which we use to send mails. We want to have some Logo in that ie ... when I send the mail to user the image should go as in-line embedded image in mail....
5
2318
by: Thierry | last post by:
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...
4
2100
by: J Huntley Palmer | last post by:
How may I setup a proper HTML mail message with embedded href links using PHP, that follows all the MIME rules? Any examples or links would be appreciated. Thanks!
0
37972
digicrowd
by: digicrowd | last post by:
http://bytes.com/images/howtos/applemail_sig_icon.jpg At first glance, it may not appear that Apple Mail (otherwise known as Mail.app) supports the use of HTML signature emails. However, with a...
10
6931
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
2
18156
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
3
7223
by: anu b | last post by:
Hii I am using System.net.mail for sending email... i need to send a webpage with its html content as my email body .....for that i used mail.Isbodyhtml as true...but it is not working for me...
0
7294
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,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.