chibineku Posted October 3, 2009 Share Posted October 3, 2009 I have a contact form, very simple, just an e-mail address field, subject field and a textarea. The e-mail message (from the textarea) comes out as one long string, even when I hit the return when typing on the form. Do I need to insert a newline character every X characters myself in PHP before sending the mail?Here is a link so you can see it for yourself:http://sinaesthesia.co.uk/contact_the_webmaster.htmlEdit: Okay, the jitteriness was caused by checking the field inputs onkeyup, now i do it onblur and it looks nicer. So, the textarea thing is the only problem and that's more a PHP issue I think.... Link to comment Share on other sites More sharing options...
Ingolme Posted October 3, 2009 Share Posted October 3, 2009 Is the E-mail being sent with an HTML content-type header? Link to comment Share on other sites More sharing options...
chibineku Posted October 3, 2009 Author Share Posted October 3, 2009 No, I hadn't been, but I added that, and to no avail. This is the PHP code: $headers = "MIME-Version: 1.0 \r\n";$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";$headers .= "To: Jonathon <chibineku@aol.com> \r\n";$headers .= "From: $tr_email \r\n";$to = "chibineku@aol.com";$subject = "AromaClear E-Mail from: $tr_email"; $msg = "From: $tr_email \r\n"; $msg .="Subject: $tr_subject \r\n"; $msg .= "Message: $tr_body \r\n";// Mail itmail($to, $subject, $msg, $headers); And this is a sample output:From: chibineku@aol.com Subject: test Message: I am testing this to see what the formatting is like for long sentences, and what happens when I hit return. Like now, for example, I left a clear space. This time, no space, but a definate carriage return. Let\'s see No formatting, and no line breaks. Also, the quote that is escaped is odd - I'm not using any sort of encoding, it must be automatic. Link to comment Share on other sites More sharing options...
Ingolme Posted October 3, 2009 Share Posted October 3, 2009 If it was being sent as HTML, that's when the line breaks wouldn't appear. Remember that in HTML, line breaks are only displayed if you use <br> elements.You can pass the string through the nl2br() function to see if anything changes. Link to comment Share on other sites More sharing options...
chibineku Posted October 3, 2009 Author Share Posted October 3, 2009 Great, that did it, thanks! Link to comment Share on other sites More sharing options...
chibineku Posted October 4, 2009 Author Share Posted October 4, 2009 For some reason, my mailto script only works if I give it a valid 'from' address - i.e. the mail doesn't reach me if I give it something bogus as the from address. That's pretty weird, since the 'to' address is hard coded and doesn't depend on the from address in any way...Hm, think it didn't like the header formatJonathon <chibineku@aol.com>Works okay without just the straight email address. Link to comment Share on other sites More sharing options...
Synook Posted October 4, 2009 Share Posted October 4, 2009 Most MTAs automatically identify emails with bogus From: fields as spam. Link to comment Share on other sites More sharing options...
chibineku Posted October 4, 2009 Author Share Posted October 4, 2009 Does that include checking if the domain exists? Spam e-mails with valid domains seem to pass. Link to comment Share on other sites More sharing options...
Synook Posted October 4, 2009 Share Posted October 4, 2009 Generally they just check the domains from the Received: and From: headers, and if they don't match they mark it as spam. Depends on how strict your spam filter is though. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.