473,390 Members | 1,269 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,390 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 15499
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.