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

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İıIşŞğĞ";

$mailtext = "<html><head>";
$mailtext .= "<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=windows-1254\">";
$mailtext .= "<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=ISO-8859-9\">";
$mailtext .= "<meta http-equiv=\"content-language\" content=\"TR\">";
$mailtext .= "</head><body>";
$mailtext .= "$mesaj";
$mailtext .= "</body></html>";

$headers .= "MIME-Version: 1.0 \n" ;
$headers .= "From: the mailer<ma****@site.com> \n";
$headers .= "X-Sender:ma****@site.com \n";
$headers .= "X-Mailer:Mailing system (ab***@me.com) \n";
$headers .= "X-Priority: 3 \n";
$headers .= "Return-Path: ma****@site.com \n";
$headers .= "Content-Type:text/html;charset=windows-1254 \n";

$email_to = "re*******@site.com";
$frommail = "ma****@site.com";
$subject_line = "Got mail from the site!";

mail($email_to,$subject_line,$mailtext, $headers);

?>
Jul 17 '05 #1
15 2021
On 9 Jul 2004 13:37:11 -0700, ce******@phreaker.net (Cem Louis) wrote:
Hi to all,

I have the following html mail sender code written in php. It is $mailtext .= "<meta http-equiv=\"Content-Type\" content=\"text/html;


Good mail sites sill dump your mails based on this.
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Jul 17 '05 #2
On 9 Jul 2004 13:37:11 -0700, ce******@phreaker.net (Cem Louis) wrote:
$mailtext .= "<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=windows-1254\">";
$mailtext .= "<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=ISO-8859-9\">";


Make up your mind which character set you're in?

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #3
Cem Louis wrote:
$headers .= "MIME-Version: 1.0 \n" ;


Mail headers should be separated by CRLF (that's "\r\n" in PHP)

--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #4
Hello

On 07/09/2004 05:37 PM, Cem Louis wrote:
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


Messages with non-ASCII characters must be sent in quoted-printable
encoding.

You may want to take a look at this class that shows how to send
messages that way. It even comes with an example of how to send a
message in Japanese, but it could be any other idiom using any other
character set:

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 #5
On Fri, 09 Jul 2004 18:15:19 -0300, Manuel Lemos <ml****@acm.org>
calmly ranted:
You may want to take a look at this class that shows how to send
messages that way. It even comes with an example of how to send a
message in Japanese, but it could be any other idiom using any other
character set:

http://www.phpclasses.org/mimemessage


Any progress on that update, Manuel?
--------------------------------------------
-- I'm in touch with my Inner Curmudgeon. --
http://diversify.com Comprehensive Website Development
================================================== ==========

Jul 17 '05 #6
Hello,

On 07/09/2004 09:54 PM, Larry Jaques wrote:
You may want to take a look at this class that shows how to send
messages that way. It even comes with an example of how to send a
message in Japanese, but it could be any other idiom using any other
character set:

http://www.phpclasses.org/mimemessage

Any progress on that update, Manuel?


What do you mean? The class supports quoted printable encoding and
custom character sets since a long time ago.

--

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 #7
Manuel Lemos <ml****@acm.org> wrote:
http://www.wiliw.com/problem2.gif


Messages with non-ASCII characters must be sent in quoted-printable
encoding.


This is not true for the body of a message, see rfc 2045 and look for
the 8bit and binary values for the content-transfer-encoding header.

--

Daniel Tryba

Jul 17 '05 #8
On Fri, 09 Jul 2004 22:04:27 -0300, Manuel Lemos <ml****@acm.org>
calmly ranted:
Hello,

On 07/09/2004 09:54 PM, Larry Jaques wrote:
You may want to take a look at this class that shows how to send
messages that way. It even comes with an example of how to send a
message in Japanese, but it could be any other idiom using any other
character set:

http://www.phpclasses.org/mimemessage

Any progress on that update, Manuel?


What do you mean? The class supports quoted printable encoding and
custom character sets since a long time ago.


How quickly they forget. ;)

-snip from 7/05 posts-
http://www.phpclasses.org/mimemessage

You provide a _very_ comprehensive class there, Manuel.
Do you by any chance have an instruction manual for it?
;)


Not yet. I can produce a reference manual soon from the class
auto-documentation. It would for instance like in this class:

http://www.phpclasses.org/xmlwriter

It will take me a few days. Just let me know if that would be useful.

Yes, please, VERY. I told my client I'd have her HTML newsletter up


It is almost done and I will probably release it later today, but if
you are in a hurry, you should look at the example scripts supplied
with the class.
-snip-

Now that things are back in context, how's it coming?
--------------------------------------------
-- I'm in touch with my Inner Curmudgeon. --
http://diversify.com Comprehensive Website Development
================================================== ==========

Jul 17 '05 #9
Hello,

On 07/10/2004 05:11 AM, Daniel Tryba wrote:
Manuel Lemos <ml****@acm.org> wrote:
http://www.wiliw.com/problem2.gif


Messages with non-ASCII characters must be sent in quoted-printable
encoding.

This is not true for the body of a message, see rfc 2045 and look for
the 8bit and binary values for the content-transfer-encoding header.


Sorry, you cannot assume that the MTA that will get the message will
support 8 bit encoded messages or else your messages may get discarded
and then you wonder why the messages were not accepted. It is better to
play safe and let MTA convert to 8 bit when it knows it can do that.
--

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 #10
Hello,

On 07/10/2004 11:47 AM, Larry Jaques wrote:
>http://www.phpclasses.org/mimemessage

You provide a _very_ comprehensive class there, Manuel.
Do you by any chance have an instruction manual for it?
;)

Not yet. I can produce a reference manual soon from the class
auto-documentation. It would for instance like in this class:

http://www.phpclasses.org/xmlwriter

It will take me a few days. Just let me know if that would be useful.

Yes, please, VERY. I told my client I'd have her HTML newsletter up

It is almost done and I will probably release it later today, but if
you are in a hurry, you should look at the example scripts supplied
with the class.
-snip-

Now that things are back in context, how's it coming?


Sorry, extensive documentation is available on the site since late
Wednesday. I assummed that you were getting automatic notifications of
update of the class that goes to all subscribers that have previously
downloaded the class.

--

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 #11
On Sat, 10 Jul 2004 14:36:57 -0300, Manuel Lemos <ml****@acm.org>
calmly ranted:
Sorry, extensive documentation is available on the site since late
Wednesday. I assummed that you were getting automatic notifications of
update of the class that goes to all subscribers that have previously
downloaded the class.


No, I hadn't/haven't. I'll redownload it now and turn the
notifications back on while I'm there. Thanks.
--------------------------------------------
-- I'm in touch with my Inner Curmudgeon. --
http://diversify.com Comprehensive Website Development
================================================== ==========

Jul 17 '05 #12
Manuel Lemos wrote:
Hello,

On 07/10/2004 05:11 AM, Daniel Tryba wrote:
Manuel Lemos <ml****@acm.org> wrote:
http://www.wiliw.com/problem2.gif
Messages with non-ASCII characters must be sent in quoted-printable
encoding.


This is not true for the body of a message, see rfc 2045 and look for
the 8bit and binary values for the content-transfer-encoding header.

Sorry, you cannot assume that the MTA that will get the message will
support 8 bit encoded messages or else your messages may get discarded
and then you wonder why the messages were not accepted. It is better to
play safe and let MTA convert to 8 bit when it knows it can do that.


And I would not assume that the email reader can understand HTML. Email
is best sent in ascii-text and if the MTA wants to convert it to HTML,
then it can...

Personally, I hate HTML mail -mainly because I primarily use a
ascii-text only reader - the other is security related.

Michael Austin.
Jul 17 '05 #13
Hello,

On 07/11/2004 11:33 PM, Michael Austin wrote:
Messages with non-ASCII characters must be sent in quoted-printable
encoding.


This is not true for the body of a message, see rfc 2045 and look for
the 8bit and binary values for the content-transfer-encoding header.
Sorry, you cannot assume that the MTA that will get the message will
support 8 bit encoded messages or else your messages may get discarded
and then you wonder why the messages were not accepted. It is better
to play safe and let MTA convert to 8 bit when it knows it can do that.


And I would not assume that the email reader can understand HTML. Email
is best sent in ascii-text and if the MTA wants to convert it to HTML,
then it can...


That is why you need to compose multipart/alternative to send HTML
properly because these can include both the plain text and HTML versions
that are displayed correctly depending on what your e-mail client can
display.

Every decent e-mail program can send messages this way. In PHP, you can
use the same class that I mentioned to compose it properly.

http://www.phpclasses.org/mimemessage
Personally, I hate HTML mail -mainly because I primarily use a
ascii-text only reader - the other is security related.


If you disable Javascript and objects that require plug-ins for viewing
HTML e-mail you are safe. If your concern is privacy (different than
security) you may use a cookies disabled mail program. I use Mozilla
Mail but you may prefer a smaller client.

--

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 #14
Manuel Lemos <ml****@acm.org> wrote:
This is not true for the body of a message, see rfc 2045 and look for
the 8bit and binary values for the content-transfer-encoding header.
Sorry, you cannot assume that the MTA that will get the message will
support 8 bit encoded messages or else your messages may get discarded
and then you wonder why the messages were not accepted.


Let's all stay in the stone age :)

It's a valid rfc, especially when one is going to use mime for html
attachments, so decent software should implement it.
It is better to play safe and let MTA convert to 8 bit when it knows
it can do that.


My terminal doesn't do 8bit, so nobody should use non-ascii characters
anywhere.

BTW although I personally don't have any unicode characterset installed,
I advocate the use of unicode (and utf-8 or utf-7 to transport it
safely).

--

Daniel Tryba

Jul 17 '05 #15
Hello,

On 07/12/2004 08:36 PM, Daniel Tryba wrote:
This is not true for the body of a message, see rfc 2045 and look for
the 8bit and binary values for the content-transfer-encoding header.
Sorry, you cannot assume that the MTA that will get the message will
support 8 bit encoded messages or else your messages may get discarded
and then you wonder why the messages were not accepted.

Let's all stay in the stone age :)

It's a valid rfc, especially when one is going to use mime for html
attachments, so decent software should implement it.


I don't think you understand the problem. Composing and sending messages
are usually separate steps. You only know if the SMTP server that
receives the message supports the 8 bit encoded messages after you
connect to it and query its capabilities. Since composition is done
before that, you can't make any assumptions when you compose the messages.

As long as you have software capable of composing messages encoded in 7
bit (ASCII), why bother trying to encode them with 8 bit characters?

If the receiving SMTP server thinks it is worth converting the messages
to an 8 bit encoding, let it do it at its own risk.

It is better to play safe and let MTA convert to 8 bit when it knows
it can do that.

My terminal doesn't do 8bit, so nobody should use non-ascii characters
anywhere.


If you only understand english, it probably does not make sense to
expect non ASCII messages. That is a problem of who reads the messages
not the MTA.
BTW although I personally don't have any unicode characterset installed,
I advocate the use of unicode (and utf-8 or utf-7 to transport it
safely).


I think you are confusing character sets with encodings. Unicode define
a character set that may be encoded as utf-8 or utf-7. You can use any 8
bit character set and encode it with quoted printable.

Quoted printable is what you should use to compose messages, not only
because the encoded messages only carry 7 bit characters despite they
may represent 8 bit text, but also it assures that the encoded message
lines do not exceed 75 characters even thouugh the text it self may have
lines of arbitrary length.
--

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 #16

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

Similar topics

3
by: Himanshu Garg | last post by:
Hello, I am trying to pinpoint an apparent bug in HTML::Parser. The encoding of the text seems to change incorrectly if the locale isn't set properly. However Parser.pm in the directory...
20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
81
by: sinister | last post by:
I wanted to spiff up my overly spartan homepage, and started using some CSS templates I found on a couple of weblogs. It looks fine in my browser (IE 6.0), but it doesn't print right. I tested...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
1
by: Peter Williams | last post by:
Hello All, I'm a newbie to this ng. I'm posting here because I have a question about debugging some javascript on some pages of my website. Please don't call me a "troll" -- because I'm not one....
40
by: VK | last post by:
Hi, After the response on my request from W3C I'm still unclear about Tidy vs. Validator discrepansies. That started with <IFRAME> issue, but there is more as I know. Anyway, this very basic...
1
by: Ryan Ginstrom | last post by:
I have been maintaining a body of documentation in plain HTML files. I would now like to automate the generation of the HTML files. Maintaining the HTML files now is tedious and error prone,...
3
by: radsat | last post by:
Hi I have a html page, which has some sites, when the user clicks on the site, <tr><td><a href="us.html" onclick = "setSiteCode('US')">USA</a></td></tr> and the javascript is, var siteCode...
1
by: reemamg | last post by:
Have a piece of code which works in Firefox however doesnt work in IE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <meta...
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: 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
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...
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,...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.