jester626 Posted January 7, 2008 Share Posted January 7, 2008 I have a couple of questions regarding forms processing. I have a form that retrieves an e-mail address from my MySQL database. it is a simple form that has a text box for the subject field and a textarea for the message body. Here is where one of my issues arises. When I type a message and I hit the return key to start a new paragraph it all looks OK in the textarea box, however when I send the e-mail it appears as one single line on the recipient's mail client. how can I process the e-mail to send as it appears (to include the carriage returns) when entered. I have played with using the <BR> tag but that is cumbersome and I'm sure it may pose a problem on systems that display e-mails as text only. Secondly, I am wanting to include a URL (http://www.whatever.com) in the e-mail and make it so when it is displayed on the email client, the person can merely click on the link as opposed to having to copy and paste it in the browser. I know this is probably a very simple fix but I am at a lost. Thank in advance Jester Quote Link to comment https://forums.phpfreaks.com/topic/84891-form-processing-questions/ Share on other sites More sharing options...
revraz Posted January 7, 2008 Share Posted January 7, 2008 Try using \n as your line seperator. Using HTML a href would probably work for a URL, but some clients have HTML turned off, like me. Quote Link to comment https://forums.phpfreaks.com/topic/84891-form-processing-questions/#findComment-432776 Share on other sites More sharing options...
chronister Posted January 7, 2008 Share Posted January 7, 2008 Well for a link to be clickable, you have to send html emails. Here is a script that I have not had any problems with at all. <?php $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "X-Mailer: PHP/" .phpversion() ."\n"; $headers .= "From: $name <$email>"; $to='somebody@email.com'; $subject = 'WebForm Question From '. $name; $body=''; mail($address , $subject, $body, $headers); ?> You have to use \n to get the line breaks in there properly. Or do it in HTML and use <br> tags. Nate Quote Link to comment https://forums.phpfreaks.com/topic/84891-form-processing-questions/#findComment-432778 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.