Gossamer Forum
Home : General : Perl Programming :

Sendmail "from" as server's address!

Quote Reply
Sendmail "from" as server's address!
My web site is hosted on a shared server. CGI scripts generate e-mails using the unix/linux sendmail facility. In these e-mails, the "from" address is shown not as what I've specified in the scripts, but in the style of:

username@server.tele.host.net

I'd prefer to have the "from" address I specify showing in the e-mails - to help make my firm look more substantial! Does anyone know of a way to achieve this?

TIA,

Quote Reply
Re: Sendmail "from" as server's address! In reply to
Using the code below should work, I don't why it isn't for you:

print MAIL "From: me\@mydomain.com\n";

The email address has to exist for this to work. If there is no such email then it will say it has been sent from whatever email address is in your vhost directive.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Sendmail "from" as server's address! In reply to
Thanks, Paul.

Yes, I don't understand why it doesn't work. I have:

print MAIL "From: $admin_email ($admin_name)\n";

where I've previously defined:

$admin_email = 'info@mydomain.com';
$admin_name = 'mycompany';

where 'mydomain.com' is the domain name. When you state "if there is no such e-mail..." I presume you just mean that it has to be defined as above (not that the server needs to recognise the email alias in any other way such as seeing a POP mail box).

Could it just be that the sendmail program on the UNIX server the domain is on forces its own e-mail address in place of what I specify, regardless of anything else I try to do?!

Quote Reply
Re: Sendmail "from" as server's address! In reply to
When I said it has to exist I did mean that it has to exist as an alias or full pop email on the server.

Try removing ($admin_name) and test it again - this sometimes causes problems for me.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Sendmail "from" as server's address! In reply to
Thanks! I'll test without the sender's name. And I'll look into establishing a pop mail box to deal with your first point.

I really appreciate you pointing me in the right direction. (A long thread of e-mails/calls with my hosting company had got nowhere.)

All the best.

Quote Reply
Re: Sendmail "from" as server's address! In reply to
Im not 100% sure about that, but scripts I've written seem to send the default email if the email I try to use in the From: field doesn't exist.

No harm in trying anyway.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Sendmail "from" as server's address! In reply to
Paul is correct...you need to have alias email addresses set-up in order to configure different email addresses in your scripts. If you do not have an account with unlimited alias email addresses, then you will have to configure additional "mailboxes" (not necessarily POP3 accounts). Some servers allow you to create a .domain file that specifies different email addresses that you can use (these are not POP3 accounts).

Regards,

Eliot Lee