LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-08-2003, 05:27 AM   #1
wood
Member
 
Registered: Aug 2003
Posts: 78

Rep: Reputation: 15
Sendmail problem


I have write a mail.cgi that when i submit my form it will send email. but when i submit, it just send to /var/mail/root. How can i let it send my the form to something like XXXX@hotmail.com

Thanks
 
Old 10-08-2003, 03:03 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Can you post it so we can see how you are calling it.
 
Old 10-08-2003, 09:09 PM   #3
wood
Member
 
Registered: Aug 2003
Posts: 78

Original Poster
Rep: Reputation: 15
This is the html file.

<form action="cgi-bin/mail.cgi" method="POST">

<pre>Your Name: <input type="text" name="name"></pre>
<pre>Email Address: <input type="text" name="email"></pre>
<pre>Age: <input type="text" name="age"></pre>
<pre>Favourie color: <input type="text" name="favourite_color"></pre>

<pre><input type="submit" value="Send"></pre>
<pre><input type="reset" value="Clear Form"></pre
</form>


and this is the mail.cgi :


#!/usr/bin/perl

print "Content-type:text/html\n\n";


read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value=~tr/+/ /;
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name}=$value;
}


$mailprog = '/usr/sbin/sendmail';


$recipient = 'soolch@hotmail.com';


open (MAIL, "|$mailprog -t") or dienice("Can't access
$mailprog!\n");


print MAIL "To: $recipient\n";

print MAIL "Reply-to: $FORM{'email'} ($FORM{'name'})\n";

print MAIL "Subject: Form Data\n\n";

foreach $key (keys %FORM) {
print MAIL "$KEY = $FORM{$key}\n";
}

close(MAIL);

print <<EndHTML;
<h2>Thank You</h2>
Thank you for writing. Your mail has been deliverd.<p>
Return to out <a href="index.html">homepage</a>.
</body></html>
EndHTML



sub dienice {
my($errmsg) = @_;
print "<h2>Error</h2>\n";
print "$errmsg<p>\n";
print "</body></html>\n";
exit;
}
 
Old 10-09-2003, 01:21 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Perl is probably assuming that the @ is an array in:
$recipient = 'soolch@hotmail.com';

Try escaping it:
$recipient = 'soolch\@hotmail.com';
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail problem hinetvenkat Linux - Networking 1 04-18-2005 08:55 AM
Problem with sendmail juanb Linux - Software 0 01-14-2004 11:18 AM
problem processing sendmail.mc to sendmail.cf ...help... lucastic Linux - Networking 1 09-21-2003 11:08 AM
Sendmail problem: sm-client permissions problem d3funct Linux - Software 0 08-12-2003 06:00 PM
please help me with a sendmail problem sthorp Linux - Networking 0 10-22-2001 02:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration