Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email 1

Status
Not open for further replies.

Grizant

Programmer
Oct 6, 2002
7
0
0
US
If I have a forms page that asks for the persons title, first and last name and there email address. How would i send html formatted e-mail to the address given by the user.
 
never tried it buthow about (on Unix systems)
my $address='email_address@someplace.somewhere';
system (&quot;mail $address < yourfile.html&quot;);

?
svar
 
This works for me on Windows:

send_mail($to, $from, $subject, $comments, $username, $userip, $useremail, $userurl, $daten, $timen);

sub send_mail {

use Net::SMTP;

my $relay = &quot;domain.com&quot;;
my $smtp = Net::SMTP->new($relay)
|| die &quot;Can't open mail connection: $!&quot;;

$smtp->mail($fromemail);
$smtp->to($masteremail);
$smtp->to($useremail);

$smtp->data();
$smtp->datasend(&quot;To: $masteremail\n&quot;);
$smtp->datasend(&quot;To: $useremail\n&quot;);
$smtp->datasend(&quot;From: $fromemail\n&quot;);
$smtp->datasend(&quot;Subject: Thank you for visiting domain.com\n&quot;);
$smtp->datasend(&quot;\n&quot;);
$smtp->datasend(&quot;\n&quot;);
$smtp->datasend(&quot;\n&quot;);
$smtp->datasend(&quot;A copy of your comments can be found below\n&quot;);
$smtp->datasend(&quot;======================================\n&quot;);
$smtp->datasend(&quot; NAME: $username($userip) at $daten($timen)\n&quot;);
$smtp->datasend(&quot; EMAIL: $useremail\n&quot;);
$smtp->datasend(&quot; HOME PAGE: $userurl\n&quot;);
$smtp->datasend(&quot; \n&quot;);
$smtp->datasend(&quot; $comments\n&quot;);
$smtp->datasend(&quot;======================================\n&quot;);

$smtp->dataend();
}
&guestbook_succ(&quot;Thank you for signing our GuestBook!<br>Your message has been successfully posted!!&quot;);
} Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
Here's a perl script to check forms, and send an email in whatever format makes sense. Nice, simple PERL program for processing forms however you want to process them, easy to install.

Download from ftp://ftp.sudval.org/users/sgray/cgi/mailing-cgi-v1.0.tgz -- info from the Linux Software Map at ftp://ftp.sudval.org/users/sgray/cgi/mailing-cgi.lsm

The source is viewable on the web at
The script uses the CGI library, and requires that the script have permission to invoke sendmail, qmail, or some other sendmail-type program.

Please write back if this helps!
-- Scott David Gray
reply-to: sgray@sudval.org
 
Newposter has a good script there for you, but not really sure why s/he decided to go with SMTP. As far as I can recal you can use HTML using sendmail and just a simple mailto form, it all depends on the recipient's mail client as to if they will accept HTML or not.

sulfericacid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top