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

70 characters limit when sending mails

Hello,

I have built a "contact us" form on my Web site and am using the PHP
mail() function to send an e-mail to the Webmaster (that's me :-))
Everything works fine. What I would like to know however is whether it
is always necessary to limit each line of the message to 70 characters,
as is written in the documentation of the function (writing for
instance $this->message = wordwrap($message, 70)).
It seems to work fine without doing it in my case and the text is
easier to read.
I guess there must be a reason for the limit, but how to find out when
it is needed?

Mar 3 '06 #1
5 4262
woof wrote:
Hello,

I have built a "contact us" form on my Web site and am using the PHP
mail() function to send an e-mail to the Webmaster (that's me :-))
Everything works fine. What I would like to know however is whether it
is always necessary to limit each line of the message to 70 characters,
as is written in the documentation of the function (writing for
instance $this->message = wordwrap($message, 70)).
It seems to work fine without doing it in my case and the text is
easier to read.
I guess there must be a reason for the limit, but how to find out when
it is needed?


It's probably because your email program (Outlook, Thunderbird, etc.) is
set up to wrap text at 70 characters. Mine is, but I can disable it.

No RFC about it, AFAIK - just the email program's attempt to keep long
lines from wrapping off the end of the screen.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 4 '06 #2
woof wrote:
Everything works fine. What I would like to know however is whether it
is always necessary to limit each line of the message to 70 characters,
as is written in the documentation of the function (writing for
instance $this->message = wordwrap($message, 70)).


RFC 822 (Standard for the Format of ARPA Internet Text Messages) and its
successor RFC 2822 (Internet Message Format) say:

| There are two limits that this standard places on the number of
| characters in a line. Each line of characters MUST be no more than
| 998 characters, and SHOULD be no more than 78 characters, excluding
| the CRLF.

In practice, it is *sometimes* safe to ignore this.

However, tf you want to allow long lines, there are smarter ways of doing
this rather than just ignoring the RFCs. For example, you could try using
one of the MIME encoding options provided by PHP.

e.g.

$msgenc = base64encode($message);
$hdrs = "Content-Type: text/plain\r\n"
. "Content-Transfer-Encoding: base64\r\n";
mail($to, $subject, $msgenc, $hdrs);

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Mar 4 '06 #3
Thank you Toby.
I understand that encoding the message would enable me to send the
message without having to worry about the recommended 70-characters per
line limit, right?
However, if I write
$msgenc = base64encode($message);
the email received is encoded (in other terms not decoded by Outlook
Express on my PC).
Is adding
Content-Transfer-Encoding: base64
sufficient?

Mar 4 '06 #4
woof wrote:
I understand that encoding the message would enable me to send the
message without having to worry about the recommended 70-characters per
line limit, right?
Yep.
However, if I write
$msgenc = base64encode($message);
the email received is encoded (in other terms not decoded by Outlook
Express on my PC).
Is adding
Content-Transfer-Encoding: base64
sufficient?


You'll also want "Content-Type:text/plain" and "MIME-Version:1.0" headers.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Mar 6 '06 #5
That's pretty clear. Thanks again.

Mar 7 '06 #6

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

Similar topics

8
by: Good Man | last post by:
Hi I'm building a 'job posting' site of sorts. When a job is available in a particular state, I want the system to send an email to everyone who is 'watching' that state. I know how to do...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
3
by: martin smith | last post by:
Here's the scenario. I'm currently using cdosys/asp to send mail to our SMTP server. We use a product called MailFilter to check for SPAM. It doesn't work very well. If MailFilter isn't working...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
2
by: Mariame | last post by:
Hi Everyone, im sending mails using this code Dim smtpmail As Mail.SmtpMail Dim msgRequest As New Mail.MailMessage msgRequest.BodyFormat = Mail.MailFormat.Html msgRequest.Subject = "Track"
5
by: cashdeskmac | last post by:
I am writing a web application will will be hosted on a few peoples laptops as a local application. It will send e-mails once the user connects to the internet. How can I set up the "Mail.From"...
8
by: Michel Posseth [MCP] | last post by:
Hi does someone has experience with this ?? i have made a lot of apps in the past that were capable of sending e-mails the server i then talked to was a Linux SMTP server and it worked great ...
2
by: srinivaspnv21 | last post by:
hi every one, plz help me out, i have to send mails from my asp.net page.... I have tried a code where mails are going only to gmail users the code is ... namespace: using System.Web.Mail;...
5
by: ravitunk | last post by:
hello all....i have the following code in my ASP.net(C#) page to send an email... MailMessage mm = new MailMessage(); StringWriter sw = new StringWriter(); HtmlTextWriter ht...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.