Hey folks,

Anyone know how to take the code below and make sure that all the stuff that gets sent to the email wordwraps at 400 pixels? Please HELP!

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
$message = wordwrap($message, 70); 
mail("rbeale@bealeinc.com,iam1az@cox.net","Membership Application","Form data:

First Name: " . $_POST['field_1'] . " 
Last Name: " . $_POST['field_2'] . " 
Your Email Address: " . $_POST['field_3'] . " 
Street Address: " . $_POST['field_4'] . " 
City: " . $_POST['field_5'] . " 
State: " . $_POST['field_6'] . " 
Zip Code: " . $_POST['field_7'] . " 
Home Phone: " . $_POST['field_8'] . " 
Work Phone: " . $_POST['field_9'] . " 
Cell Phone: " . $_POST['field_10'] . " 
Name of Emergency Contact: " . $_POST['field_11'] . " 
Phone of Emergency Contact: " . $_POST['field_12'] . " 
Relationship To You: " . $_POST['field_13'] . " 
Brief History of Yourself: " . $_POST['field_14'] . " 
Make of Motorcycle You Own: " . $_POST['field_15'] . " 
Model of Motorcycle you Own: " . $_POST['field_16'] . " 
Year of Motorcycle You Own: " . $_POST['field_17'] . " 
Years of Riding Experience: " . $_POST['field_18'] . " 
State Reason For Joining: " . $_POST['field_19'] . " 



 
");

include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}

?>

Thanks

Benjamin

While you can wrap at a certain amount of characters in plain text emails, I'm not certain about the ability to wrap at exactly 400 pixels.

What you can do is send and html email instead, and put the text inside a container that is set to 400 pixels wide.

commented: Good tip +3

Hey folks,

Anyone know how to take the code below and make sure that all the stuff that gets sent to the email wordwraps at 400 pixels? Please HELP!

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
$message = wordwrap($message, 70); 
mail("rbeale@bealeinc.com,iam1az@cox.net","Membership Application","Form data:

First Name: " . $_POST['field_1'] . " 
Last Name: " . $_POST['field_2'] . " 
Your Email Address: " . $_POST['field_3'] . " 
Street Address: " . $_POST['field_4'] . " 
City: " . $_POST['field_5'] . " 
State: " . $_POST['field_6'] . " 
Zip Code: " . $_POST['field_7'] . " 
Home Phone: " . $_POST['field_8'] . " 
Work Phone: " . $_POST['field_9'] . " 
Cell Phone: " . $_POST['field_10'] . " 
Name of Emergency Contact: " . $_POST['field_11'] . " 
Phone of Emergency Contact: " . $_POST['field_12'] . " 
Relationship To You: " . $_POST['field_13'] . " 
Brief History of Yourself: " . $_POST['field_14'] . " 
Make of Motorcycle You Own: " . $_POST['field_15'] . " 
Model of Motorcycle you Own: " . $_POST['field_16'] . " 
Year of Motorcycle You Own: " . $_POST['field_17'] . " 
Years of Riding Experience: " . $_POST['field_18'] . " 
State Reason For Joining: " . $_POST['field_19'] . " 



 
");

include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}

?>

Thanks

Benjamin

I think you have misunderstood what I wanted or don't know how to do this. It should be simple for someone who knows php to come up with a fix on this code to make the email it generates word wrap.

To restate: I want this code that sends an email to have the results that it generates within the email WORD WRAP at 100 characters including spaces.

HELP!

commented: Dude it's not my fault you didnt express yourself well. -1

So are you saying that I have to define the text that is wrapped before it will wrap it? In this case the input variables are always different. They are putting in things like address and reasons for joining. These will never be constant.

What do you do in the case listed above to make an unknown variable text wordwrap at such and such column width? Please use the php exactly as listed.

Excellent resource by the way this PHP library. Problem is I don't know PHP yet. I want to learn it but I have this pressing problem that needs solving now.

Please continue to help me figure this out.

Benjamin

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.