jimfog Posted July 18, 2013 Share Posted July 18, 2013 In the PHP manual it is stated that the length of the lines of a message handled by the mail function should not exceed 70 characters. Does that mean-in other words- that when setting a textarea for the message body of a contact form(for example) its cols attribute must not exceed 70? Am I correct on the above? Link to comment Share on other sites More sharing options...
Ingolme Posted July 18, 2013 Share Posted July 18, 2013 The cols attribute only limits the writing space, it doesn't actually force line breaks into the resulting string. The mail() part of the manual shows an example of how to break a string onto 70-character lines. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 18, 2013 Share Posted July 18, 2013 No, the cols attribute controls how wide the text box is, you can still write lines longer and they will just wrap. It doesn't automatically add a line break to the text, it just shows the text on the next line. Link to comment Share on other sites More sharing options...
jimfog Posted July 18, 2013 Author Share Posted July 18, 2013 (edited) The mail() part of the manual shows an example of how to break a string onto 70-character lines. I suppose you mean this. $message = wordwrap($message, 70, "rn"); Edited July 18, 2013 by jimfog Link to comment Share on other sites More sharing options...
jeffman Posted July 18, 2013 Share Posted July 18, 2013 FWIW, mail is tricky. If you get beyond simple messages, you might want more help than the usual sources give you. Here's a trick I used. With a mail client like Thunderbird, I sent messages to myself. Thunderbird is good because it lets you view the raw source of your email -- the parts you see and the parts you don't see. Other programs do this too. Thunderbird is just an example. One thing I learned is that the email client uses different header values depending on different circumstances. For example, if all your characters are plain ASCII, it sends one kind of Content-Type header. If you send some UTF characters, it sends another kind of Content-Type header. And if you send any HTML at all, or an attachment, or any combination of that, everything gets very complicated. This is why a lot of developers use Pear. When you study the raw source for each kind of email, you can get a good idea how to format your own messages and headers. It's one thing to read the rules in the manual. It's another thing to read the specification. It's another thing to read tutorials. Seeing it done for real helped me understand it much better. (Tutorial authors almost always make an important mistake or forget to tell you something important.) I also compared what I learned by studying the raw source generated by a different email client. Some things, there are multiple ways to get a thing done. Other things, you have to do it exactly the same way every time. Link to comment Share on other sites More sharing options...
jimfog Posted July 19, 2013 Author Share Posted July 19, 2013 I will see what options PEAR has to offer. But I have 1 more question to make-a small one. When I get a mail in Outlook I often see in the from field the mail the mail of the sender along with a name. Example: Test nesletter(test@nesletter). Is it possible to adjust the header section of the mail function such that I can have the above result? Or do I have to do it manually? Link to comment Share on other sites More sharing options...
jeffman Posted July 19, 2013 Share Posted July 19, 2013 You can format any address so it looks like this: Real Name <user@domain.com> You must pass that entire string, already formatted. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now