[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to fake from address in an email



On Wed, Dec 13, 2000 at 03:08:18PM -0700, debuser@platinum.globalmart.com wrote:
> We need to send out an email response from a CGI when someone places an
> order, but we want to set the from address to something other than the
> user/machine where the CGI is running. How to do this with the various
> email packages? Currently using exim, but may switch to postfix or
> sendmail.

using perl? try something such as this pseudo pseudocode:

    use Net::SMTP;
	my $SMTP_SERVER = 'mail.my.server.net.org.not';

    my $smtp = Net::SMTP->new( $SMTP_SERVER );

	# here's your "FROM:" email address, whatever you want it to be
    $smtp->mail($FROM_ADDR);

    # goes to all these, with or without "To:" header
    $smtp->to(@SEVERAL_ADDRS);

    $smtp->data();
    $smtp->datasend( <<"E-PISTLE" );
	To: $PICK_ANY_DEST_ADDR_DOESNT_AFFECT_WHERE_ITS_SENT
	Reply-To: $FROM_ADDR
	Subject: $SUBJ
	Content-Type: text/plain

	Here's your stinkin' email.

	E-PISTLE
    $smtp->dataend();
    $smtp->quit;

of course, tmtowtdi.

-- 
There are only two places in the world where time takes
precedence over the job to be done.  School and prison. 
					--William Glasser 

will@serensoft.com    ***    http://www.dontUthink.com/

volunteer to document your experience for next week's
newbies -- http://www.eGroups.com/messages/newbieDoc



Reply to: