Re: sending form data as email using SMTP server ???
try using mail() function. (http://es.php.net/manual/en/function.mail.php)
sending form data as email using SMTP server ???
Collapse
This topic is closed.
X
X
-
Guest replied -
Guest repliedRe: sending form data as email using SMTP server ???
James <James@NotHere. com> wrote in message
news:<cdimgvk19 3nentic1pbkr5qf rgjphcj9v7@4ax. com>...[color=blue]
>
> How can I take my form data and send it as an email using my SMTP server
> located @ my ISP using PHP ?
>
> my form has several fields:
>
> TO: this is a drop down list
> FROM: this is a drop down list
> SUBJECT: Free Type
> MESSAGE: Free Type
> CC: Check Box
>
> what I need to do is send the email TO the user selected, FROM the user
> selected, with the Subject and Message, If ticked CC then copied to the
> FROM user !
>
> Any Ideas ?[/color]
Actually, two. :)
1. If your ISP allows you to use the mail() function and has it
properly configured:
if ($_POST) {
$to = $_POST['TO'];
$from = $_POST['FROM'];
$subject = $_POST['SUBJECT'];
$message = $_POST['MESSAGE'];
} else {
die ('What the heck am I supposed to mail?');
}
$headers = 'From: ' . $from . "\r\n";
if ($_POST['CC']) {
$headers .= 'Cc: ' . $from . "\r\n";
}
mail ($to, $subject, $message, $headers);
2. If not, get yourself a copy of phpMailer (http://phpmailer.sf.net/)
and send your message via an external SMTP server:
require ('class.phpmail er.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'smtp.mysite.co m';
$mail->SMTPAuth = true; // These three lines are necessary
$mail->Username = 'me'; // only if your SMTP server
$mail->Password = 'my_password'; // requires authentication
$mail->From = $_POST['FROM'];
if ($_POST['CC']) {
$mail->AddCC($_POST['FROM']);
}
$mail->Subject = $_POST['SUBJECT'];
$mail->IsHTML(false );
$mail->Body = $_POST['MESSAGE'];
$mail->Send();
Cheers,
NC
Leave a comment:
-
Guest repliedRe: sending form data as email using SMTP server ???
although i don't think there's a CC function - just use the from: as an
additional to: if it's checked, which should work.
"Matt Montgomery" <NOSPAMmatt@NOS PAMchums.com> wrote in message
news:sWHOa.79$n W5.126835@news. uswest.net...[color=blue]
> php.net - search for the email functions.
>
> "James" <James@NotHere. com> wrote in message
> news:cdimgvk193 nentic1pbkr5qfr gjphcj9v7@4ax.c om...[color=green]
> > How can I take my form data and send it as an email using my SMTP server
> > located @ my ISP using PHP ?
> >
> > my form has several fields:
> >
> > TO: this is a drop down list
> >
> > FROM: this is a drop down list
> >
> > SUBJECT: Free Type
> >
> > MESSAGE: Free Type
> >
> > CC: Check Box
> >
> > what I need to do is send the email TO the user selected, FROM the user
> > selected, with the Subject and Message, If ticked CC then copied to the
> > FROM user !
> >
> > Any Ideas ?
> >
> > Thanks
> >
> >[/color]
>
>[/color]
Leave a comment:
-
Guest repliedRe: sending form data as email using SMTP server ???
php.net - search for the email functions.
"James" <James@NotHere. com> wrote in message
news:cdimgvk193 nentic1pbkr5qfr gjphcj9v7@4ax.c om...[color=blue]
> How can I take my form data and send it as an email using my SMTP server
> located @ my ISP using PHP ?
>
> my form has several fields:
>
> TO: this is a drop down list
>
> FROM: this is a drop down list
>
> SUBJECT: Free Type
>
> MESSAGE: Free Type
>
> CC: Check Box
>
> what I need to do is send the email TO the user selected, FROM the user
> selected, with the Subject and Message, If ticked CC then copied to the
> FROM user !
>
> Any Ideas ?
>
> Thanks
>
>[/color]
Leave a comment:
-
sending form data as email using SMTP server ???
How can I take my form data and send it as an email using my SMTP server
located @ my ISP using PHP ?
my form has several fields:
TO: this is a drop down list
FROM: this is a drop down list
SUBJECT: Free Type
MESSAGE: Free Type
CC: Check Box
what I need to do is send the email TO the user selected, FROM the user
selected, with the Subject and Message, If ticked CC then copied to the
FROM user !
Any Ideas ?
Thanks
Tags: None
Leave a comment: