Jump to content

basic mailing


NickG21

Recommended Posts

hey everyone, i am trying to write a small validation script of some information on a single form page and at the end of the validation if everything is correct mail ALL of the entered information to myself.  my quick mail statement looks like this:
[CODE] mail('[email protected]',$subject, $problem,"From: $name <$email>");[/CODE]
but i am unable to send the other variables that are passed from the form into the session because there are only 8 parameters allowed in mail();.  i am new to this as you can probably tell and was wondering if i could take the other 5 or 6 variables i pass into validation and make them be the body of the mail?
any help is appreciated
Link to comment
https://forums.phpfreaks.com/topic/33591-basic-mailing/
Share on other sites

Yes, you just need to include them in the body, like this:

[code]<?php
// Here's the values from my form
$fav_colour = $_POST['colour'];
$fav_food = $_POST['food'];
$fav_animal = $_POST['animal'];

// Here's the to and subject fields
$to = "[email protected]";
$subject = "My Test Email";

// Here's the values from my form all combined into one message variable
$msg .= "My favourite colour is $fav_colour\n";
$msg .= "My favourite food is $fav_food\n";
$msg .= "My favourite animal is $fav_animal\n";

// Send the message
mail($to, $subject, $msg);
?>[/code]

Regards
Huggie
Link to comment
https://forums.phpfreaks.com/topic/33591-basic-mailing/#findComment-157366
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.