473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
Jul 16 '05 #1
4 15493
php.net - search for the email functions.

"James" <Ja***@NotHere.com> wrote in message
news:cd********************************@4ax.com...
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

Jul 16 '05 #2
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" <NO********@NOSPAMchums.com> wrote in message
news:sW*****************@news.uswest.net...
php.net - search for the email functions.

"James" <Ja***@NotHere.com> wrote in message
news:cd********************************@4ax.com...
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


Jul 16 '05 #3
James <Ja***@NotHere.com> wrote in message
news:<cd********************************@4ax.com>. ..

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 ?


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.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'smtp.mysite.com';
$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
Jul 16 '05 #4
try using mail() function. (http://es.php.net/manual/en/function.mail.php)
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
3
by: Jared | last post by:
Hello people, I've had major difficulties finding the right Java technology that can be used to make an e-mail applet program. I'm trying to build an applet that would be similar, but much...
13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
1
by: mark | last post by:
I need to send order confirmation emails through my asp.net storefront. With my Asp 3.0 sites I use cdonts with no issues. I've researched the system.web.mail asp.net way and haven't got it to...
8
by: Frank | last post by:
I think I've confused myself completely here :-) I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the client if they're email server supported SMTP, and...
9
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
3
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.