Jump to content

Sending Multiline Emails?


random1

Recommended Posts

Hi All,

 

I have the following code and it is sending an email but not allowing multiple lines in the <textarea>.

 

It dies on submition of the form when the text area contains more than one line (is it because of %0D%?).

 

How can this issue be fixed?

 

e.g.

 

http://www.example.com.au/product_info.php?field_name=Test&field_email=test%40test.com&field_message=test1%0D%0A2%0D%0A3%0D%0A4&button_send=Send+Query&tester=test356645667&formcontact=Yes

 

Logic Code:

 

<?php

 

if($_REQUEST['formcontact'] == "Yes")

{

 

$domain = "http://www.example.com.au"; // Must be changed to actual domain

 

$destinationemail = "test@example.com.au"; // Must be changed to actual company email

 

$name = $_REQUEST['field_name'];

$email = $_REQUEST['field_email'];

$message = $_REQUEST['field_message'];

 

if($email != "" && $name != "" && $message != "")

{

 

$outputmessage =

"<p>$name has sent an email from the TEST ONLY website.</p>".

"<p>$name's email is $email.</p>".

"<p>$name's query:</p>".

"<p>$message</p>"; // The formatted message

 

mail( $destinationemail, "TEST Website Contact Form Result - $name",

$outputmessage, "From: $email\nReply-To: $email\nContent-Type: text/html" );

$formstatus = "Sent";

}

else

{

$formstatus = "Failed";

}

 

}

 

?>

 

Form Code:

 

<form action="<?php echo $_SERVER['PHP_SELF'];?>"

name="form_message" id="form_message">

<div style="text-align:left; align:left; margin-left:6px;">

<label>Full Name:*</label><br />

<input type="text" name="field_name" value="<?php echo $name ?>" size="25" id="field_name" /><br />

<label>Email:*</label><br />

<input type="text"id="field_email" value="<?php echo $email ?>" size="25" name="field_email" /><br />

<label>Your Query:*</label><br />

<textarea style="align:left;" name="field_message"

cols="25" rows="3" id="field_message"><?php echo $message ?></textarea><br />

<input type="submit" value="Send Query" id="button_send" name="button_send" />

<input type="hidden" id="tester" name="tester"

value="test356645667" />

<input type="hidden" id="formcontact" name="formcontact"

value="Yes" />

</div>

</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.