R
Robert TV
Hey everyone, I am having a problem with Sendmail for Perl. I have a web
page with five fields.
Four textbox fields are:
"fname" = From name
"femail" = From email
"tname" = To name
"temail" = To email
1 textarea:
"contents" = Email contents
The script itself seems to be working fine. I input names and email
addresses in the "to" and "from" fields and add contents. The e-mail send
correctly and it gets to my inbox. When I open the e-mail in M$ Outlook,
instead of reading EG:
From: Robert ([email protected])
To: John ([email protected])
It's reading this:
From Andy Raxin ([email protected]) on behalf of Robert
([email protected])
To: John ([email protected])
Notice the "on behalf" above. Sendmail is getting my own personal name and
email address from the hosting config and showing this as on behalf of what
I program in the Web page form fields. Here is a section of the email
header:
Date: Thu, 20 Nov 2003 17:39:15 -0800
From: Robert <[email protected]>
Subject: Test Subject
Sender: Andy Raxin <[email protected]>
To: John <[email protected]>
Sendmail is attaching a "Sender" header to the email (as seen in line 3 of
the headers above), and Outlooks see's this and thus puts in the "on behalf"
in it's final message. I have been reading Sendmail manuals like crazy but
can't figure out a way to get rid of this "on behalf" thingy. I assume it
can be done because FormMail doesn't do this. FormMail uses the variables
"-t -i" and I use them too, to no avail. Can someobe help me? I do not want
my name and email address showing as the From on behalf, I want to show it
as being from who I enter into the Web page form fields. Here is my code:
#!/usr/bin/perl
use Fcntl qwDEFAULT :flock);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$mailprog="/usr/sbin/sendmail -t -i";
$fname = CGI:aram('fname');
$femail = CGI:aram('femail');
$tname = CGI:aram('tname');
$temail = CGI:aram('temail');
@contents = CGI:aram('contents');
open (MAIL, "|$mailprog") or die "Can't open mail program: $!";
print MAIL "From: $fname <$femail>\n";
print MAIL "To: $tname <$temail>\n";
print MAIL "Subject: Test Subject\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "X-MSMail-Priority: $priority\n";
print MAIL "Content-Type: multipart/alternative;\n";
print MAIL " boundary=\"separator\"\n\n";
print MAIL "This is a multi-part message in MIME format.\n\n";
print MAIL "--separator\n";
print MAIL "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: 7bit\n\n";
print MAIL "@contents\n\n";
print MAIL "--separator\n";
print MAIL "Content-Type: text/html; charset=\"iso-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: 8bit\n\n";
print MAIL "<html>\n";
print MAIL "<head>\n";
print MAIL "</head>\n\n";
print MAIL "<body>\n\n";
print MAIL "@contents\n";
print MAIL "</body>\n";
print MAIL "</html>\n\n";
print MAIL "--separator--";
close (MAIL);
print "Content-type: text/html \n\n";
print "Mail sent";
exit;
Please and thank you to all who reply!!!!!
Andy
page with five fields.
Four textbox fields are:
"fname" = From name
"femail" = From email
"tname" = To name
"temail" = To email
1 textarea:
"contents" = Email contents
The script itself seems to be working fine. I input names and email
addresses in the "to" and "from" fields and add contents. The e-mail send
correctly and it gets to my inbox. When I open the e-mail in M$ Outlook,
instead of reading EG:
From: Robert ([email protected])
To: John ([email protected])
It's reading this:
From Andy Raxin ([email protected]) on behalf of Robert
([email protected])
To: John ([email protected])
Notice the "on behalf" above. Sendmail is getting my own personal name and
email address from the hosting config and showing this as on behalf of what
I program in the Web page form fields. Here is a section of the email
header:
Date: Thu, 20 Nov 2003 17:39:15 -0800
From: Robert <[email protected]>
Subject: Test Subject
Sender: Andy Raxin <[email protected]>
To: John <[email protected]>
Sendmail is attaching a "Sender" header to the email (as seen in line 3 of
the headers above), and Outlooks see's this and thus puts in the "on behalf"
in it's final message. I have been reading Sendmail manuals like crazy but
can't figure out a way to get rid of this "on behalf" thingy. I assume it
can be done because FormMail doesn't do this. FormMail uses the variables
"-t -i" and I use them too, to no avail. Can someobe help me? I do not want
my name and email address showing as the From on behalf, I want to show it
as being from who I enter into the Web page form fields. Here is my code:
#!/usr/bin/perl
use Fcntl qwDEFAULT :flock);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$mailprog="/usr/sbin/sendmail -t -i";
$fname = CGI:aram('fname');
$femail = CGI:aram('femail');
$tname = CGI:aram('tname');
$temail = CGI:aram('temail');
@contents = CGI:aram('contents');
open (MAIL, "|$mailprog") or die "Can't open mail program: $!";
print MAIL "From: $fname <$femail>\n";
print MAIL "To: $tname <$temail>\n";
print MAIL "Subject: Test Subject\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "X-MSMail-Priority: $priority\n";
print MAIL "Content-Type: multipart/alternative;\n";
print MAIL " boundary=\"separator\"\n\n";
print MAIL "This is a multi-part message in MIME format.\n\n";
print MAIL "--separator\n";
print MAIL "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: 7bit\n\n";
print MAIL "@contents\n\n";
print MAIL "--separator\n";
print MAIL "Content-Type: text/html; charset=\"iso-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: 8bit\n\n";
print MAIL "<html>\n";
print MAIL "<head>\n";
print MAIL "</head>\n\n";
print MAIL "<body>\n\n";
print MAIL "@contents\n";
print MAIL "</body>\n";
print MAIL "</html>\n\n";
print MAIL "--separator--";
close (MAIL);
print "Content-type: text/html \n\n";
print "Mail sent";
exit;
Please and thank you to all who reply!!!!!
Andy