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 = "[email protected]"; // 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
https://forums.phpfreaks.com/topic/95565-sending-multiline-emails/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.