Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

sending an email with long message

the mail() function

Moderators: macek, egami, gesf

sending an email with long message

Postby sbrooks99 » Sat Aug 04, 2012 9:51 pm

I am a complete newbie to PHP.

I am trying to send an email from Flash but the variable is really long so I am trying to split the varaible up.
I've done something wrong here I'm sure. Can someone solve it for me?

Code: Select all
$to = ($_POST['email']);
$subject = "Your Answers";
$message = "Hi" . $_POST['name'] . "\n";
$message .= "Here are your given answers: \n\n";

$array = explode(" ", $_POST['message']);
for ($i = 0, $array_num = count($array); $i < $array_num; $i++) {
    $word_split = wordwrap($array[$i], 15, " ", true);
    $message .="$word_split ";

$message .= $word_split;

$message .= "\n\n---------------------------\n";
$message .= "From: " . $_POST['name'] . "Email: " . $_POST['email']  . "\n";

if(@mail("$to", "Your Answers", $message, $headers))
    echo "answer=ok";

    echo "answer=error";

Thanks so much
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Aug 04, 2012 9:46 pm

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.