Register
It is currently Thu Apr 17, 2014 6:14 pm

email question


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Fri Jan 30, 2009 9:45 am   

Joined: Sat Jun 04, 2005 3:16 am
Posts: 16
Location: That Lunar Colony That Everybody Denies the Existance of.
At work, I wrote some bash scripts with proccgi to make a form that we enter some information into, then it pulls other data from our ticketing system. The script then assembles an email and sends it to certain people. Who it gets sent to is determined by a selectbox in the form. To increase security, the people who get our emails will now only accept these emails from certain addresses. Is there a way to send emails from the command line that let me specify who the sender is? Or is this something I have to configure in the exim setup? Originally I just used a "heredocument" to pipe the body of the email to the mail command. Now I'm trying to pipe the text of the email to /usr/lib/sendmail -t with the FROM, TO, etc lines being specified, but they still detect it being sent by the webserver user, which they reject.

This form saves us a lot of time typing, any tips will be appreciated.


Top
 Profile  
 PostPosted: Fri Jan 30, 2009 11:12 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 224
Location: London - UK
from the sendmail man page;

-fname Sets the name of the ‘‘from’’ person. This option is valid only if no From: line is specified within the header of the email.

I've heard that on some systems this can only be done by root, but I know that on redhat systems it works ok

if that is an issue you should be able to configure exim to accept that, but i don't know how


Top
 Profile  
 PostPosted: Thu Feb 05, 2009 11:58 pm   

Joined: Sat Jun 04, 2005 3:16 am
Posts: 16
Location: That Lunar Colony That Everybody Denies the Existance of.
I don't know if -fname will help because the /usr/lib/sendmail is just exim, they provide a "sendmail" command for script compatibility, but I'll try it. Maybe I could make the webserver run under a different user and change the domain in /etc/mailname, but it seems like it should be easier to do something on the command line, but then I don't know what that something is! Maybe you can't for security reasons.


Top
 Profile  
 PostPosted: Fri Feb 06, 2009 2:46 am   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
You could always write a php script to handle this if CGI can't.

the mail(); function provides you with the possibilty to add headers to your mailed format.
I've done this a couple of times and it works like a charm, even my insanely paranoid smtp allows mails throu as long as all the header information is properly specified.

Best regards
Fredrik Eriksson


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP