473,387 Members | 1,882 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,387 software developers and data experts.

PHP create HTML email inserts '!'s

OK,

I'm trying to create an email and when it sends the email, it mostly
works except that there are '!' inserted at some spots. Checking the
html source of the email, looks like they are placed at the end of
long lines. I'm assuming there is some issue with the encoding, but
searching through groups, nothing I've tried has worked. Can someone
let me know if I should be doing something differently with my headers
for an html email? I'll change emails to nu**@null.com. Thanks!

$headers = "X-Mailer: PHP " . phpversion() . "\r\n";
$headers .= "From: nu**@null.com\r\n";
$headers .= "Reply-To: nu**@null.com\r\n";
$headers .= "Content-Type: text/html;\r\n";
$headers .= "charset=\"iso-8859-1\"\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";

Feb 7 '07 #1
7 3541
Hello,

on 02/07/2007 05:03 PM geek7 said the following:
OK,

I'm trying to create an email and when it sends the email, it mostly
works except that there are '!' inserted at some spots. Checking the
html source of the email, looks like they are placed at the end of
long lines. I'm assuming there is some issue with the encoding, but
searching through groups, nothing I've tried has worked. Can someone
let me know if I should be doing something differently with my headers
for an html email? I'll change emails to nu**@null.com. Thanks!

$headers = "X-Mailer: PHP " . phpversion() . "\r\n";
$headers .= "From: nu**@null.com\r\n";
$headers .= "Reply-To: nu**@null.com\r\n";
$headers .= "Content-Type: text/html;\r\n";
$headers .= "charset=\"iso-8859-1\"\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
I think you need to encode your message with MIME quoted-printable.

If you do not know how to compose MIME quoted-printable messages, you
may want to try this MIME message class:

http://www.phpclasses.org/mimemessage

It is also better to include an alternative plain text part using
multipart/alternative MIME parts. This is not related to you problem.
Just a comment after noticing you used Content-Type set to text/html .
The class above can also help solving that problem.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Feb 7 '07 #2
geek7 wrote:
$headers .= "Content-Type: text/html;\r\n";
$headers .= "charset=\"iso-8859-1\"\r\n";
This is broken.

Should be either:

$headers .= "Content-Type: text/html; ";
$headers .= "charset=\"iso-8859-1\"\r\n";

or:

$headers .= "Content-Type: text/html;\r\n";
$headers .= "\tcharset=\"iso-8859-1\"\r\n";

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Feb 9 '07 #3
I have been struggling with this for a while now.. I did change the
errors like Toby said, and it did fix another problem I had, but I
still cannot figure out how to properly use the mimemessage class.
Does anyone have an example of this class encoding with quoted
printable? I'm sure the answer is in the documentation staring me in
the face, but I'm fairly new to PHP and can't get it. Thanks ahead of
time!

Derek

Mar 1 '07 #4
On Mar 1, 2:09 pm, "geek7" <dpoe...@gmail.comwrote:
I have been struggling with this for a while now.. I did change the
errors like Toby said, and it did fix another problem I had, but I
still cannot figure out how to properly use the mimemessage class.
Does anyone have an example of this class encoding with quoted
printable? I'm sure the answer is in the documentation staring me in
the face, but I'm fairly new to PHP and can't get it. Thanks ahead of
time!

Derek
I will suggest using this class and enjoy instead of wasting time on
email.
Here you can send html and text mail, both at a time also. client who
do not understand
html will display text msg. Work for attachment, and more.

phpmailer.sourceforge.net/

Mar 3 '07 #5
Hello,

on 03/01/2007 04:09 PM geek7 said the following:
I have been struggling with this for a while now.. I did change the
errors like Toby said, and it did fix another problem I had, but I
still cannot figure out how to properly use the mimemessage class.
Does anyone have an example of this class encoding with quoted
printable? I'm sure the answer is in the documentation staring me in
the face, but I'm fairly new to PHP and can't get it. Thanks ahead of
time!
Take a look at the test_simple_html_mail_message.php script that uses
the MIME message class to compose and send quoted-printable HTML
messages that avoid the ! problem.

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

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Mar 4 '07 #6
On Mar 4, 1:17 am, Manuel Lemos <mle...@acm.orgwrote:
Hello,

on 03/01/2007 04:09 PM geek7 said the following:
I have been struggling with this for a while now.. I did change the
errors like Toby said, and it did fix another problem I had, but I
still cannot figure out how to properly use the mimemessage class.
Does anyone have an example of this class encoding with quoted
printable? I'm sure the answer is in the documentation staring me in
the face, but I'm fairly new toPHPand can't get it. Thanks ahead of
time!

Take a look at the test_simple_html_mail_message.phpscript that uses
the MIME message class to compose and send quoted-printableHTML
messages that avoid the ! problem.

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generatorhttp://www.metastorage.net/

PHPClasses - Free ready to use OOP components written inPHPhttp://www.phpclasses.org/

Manuel,

This helps a ton! I got the email to format correctly, but I have just
one more issue if you could help I would greatly appreciate it. I am
trying to add multiple addresses to the email I wrote. Looking in the
documentation, it says I can use:

$message_object->SetMultipleEncodedEmailHeader('Bcc', array(
'p****@gabriel.org' ='Peter Gabriel',
'p***@simon.net' ='Paul Simon',
'm***@chain.com' ='Mary Chain'
);

but When I do this, no one gets the email..same if I change 'Bcc' to
'To'. Do I need to change all my SetEncodedEmailHeader functions to
SetMultipleEncodedEmailHeader? Or is there an easy way to do multiple
addresses...(other than putting one in the to, cc, and bcc...) thanks!

Mar 7 '07 #7
Hello,

on 03/07/2007 01:20 PM geek7 said the following:
>>I have been struggling with this for a while now.. I did change the
errors like Toby said, and it did fix another problem I had, but I
still cannot figure out how to properly use the mimemessage class.
Does anyone have an example of this class encoding with quoted
printable? I'm sure the answer is in the documentation staring me in
the face, but I'm fairly new toPHPand can't get it. Thanks ahead of
time!
Take a look at the test_simple_html_mail_message.phpscript that uses
the MIME message class to compose and send quoted-printableHTML
messages that avoid the ! problem.

http://www.phpclasses.org/mimemessage
>
This helps a ton! I got the email to format correctly, but I have just
one more issue if you could help I would greatly appreciate it. I am
trying to add multiple addresses to the email I wrote. Looking in the
documentation, it says I can use:

$message_object->SetMultipleEncodedEmailHeader('Bcc', array(
'p****@gabriel.org' ='Peter Gabriel',
'p***@simon.net' ='Paul Simon',
'm***@chain.com' ='Mary Chain'
);

but When I do this, no one gets the email..same if I change 'Bcc' to
'To'. Do I need to change all my SetEncodedEmailHeader functions to
SetMultipleEncodedEmailHeader? Or is there an easy way to do multiple
addresses...(other than putting one in the to, cc, and bcc...) thanks!
Not getting messages when you set all to Bcc is normal. Many mail
filters do not like that. As for To: it should work . If it doesn't,
there may be some other problem.

You can also try set the To header with the SetHeader function, only
with e-mail addresses separated with commas , .

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Mar 7 '07 #8

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

Similar topics

2
by: Nick | last post by:
Loop to create an array from a dynamic form. I'm having trouble with an application, and I'll try to explain it as clearly as possible: 1. I have a form with two fields, say Apples and...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
10
by: st4 | last post by:
Help, As part of my family history web site i need to get 150 pages of typed text into some format to display. It just text right now but I would like to add some graphics (photos) and make the...
2
by: Alicia | last post by:
Does anyone know why I am getting a "Syntax error in Create Table statement". I am using Microsoft Access SQL View to enter it. Any other problems I may run into? CREATE TABLE weeks (...
14
by: hgraham | last post by:
Hi, I'm trying to understand how to work the dom, and all I'm trying to do is insert a link right before another link in the html based on it's href value. This isn't a real world example - I'm...
11
by: ra294 | last post by:
I am building a page that needs to recieve some parametes and return blank page (empty response). After I recieve the parametes I write: Response.clear Response.End When I run the page I still...
5
by: vasan999 | last post by:
Basically, it should do all that any of the tools below and in addition, 1/ human readable output that maintains the text lines of the source, ie does not scramble the text lines or insert...
1
by: =?Utf-8?B?aGZkZXY=?= | last post by:
Hello, I have a web application that makes use of the SQL Membership and Role providers. My app has admin screens to manage users (membership), roles, and supplementary user data. I have just...
17
by: V S Rawat | last post by:
I joined this ng and tried to post my first message that had a small php code (HTML and all). my newsserver aioe.net rejected the post saying "HTML Tags". My message was in text format, not in...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.