LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 07-20-2009, 07:17 PM   #1
scgtrp
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Rep: Reputation: 1
Postfix: sending mail from multiple domains


I'm running a server with two sites which both need to be able to send emails. Currently I have Postfix set up to send email via Google Apps. This works fine, but Google's servers ignore the From: address I specify and substitute the one I logged in with. Is there a way to make Postfix log into Google Apps with a different username based on what site the email is coming from? The server does not recieve any mail itself; Google recieves it and we have it set to forward it to the appropriate person's real email address. I'm only worried about sending mail.

(Postfix is not a requirement here, so if there's another mailer that can do this better, I'm open to ideas. However, sending email directly from the server isn't an option as it's a residential IP address and blocked by most of the big email providers.)
 
Old 07-20-2009, 09:57 PM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 1,492

Rep: Reputation: 144Reputation: 144
You can use login credentials based on the envelope From: address, as explained here.
 
Old 07-20-2009, 11:19 PM   #3
scgtrp
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Original Poster
Rep: Reputation: 1
Thanks! That works when I use it from the command line, like this:
Code:
echo 'Test email #1240' |sendmail -f noreply@mydomain.com myemail@gmail.com
But it seems PHP doesn't pass -f to sendmail. sendmail seems to ignore that address when deciding how to authenticate, so I get this in my mail.log:
Quote:
Jul 20 10:58:58 farfalle postfix/smtp[9455]: 195A329CD67: to=<myemail@gmail.com>, relay=smtp.gmail.com[209.85.133.111]:587, delay=45, delays=44/0/0.42/0.02, dsn=5.5.1, status=bounced (host smtp.gmail.com[209.85.133.111] said: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://mail.google.com/support/bin/a...y?answer=14257 c37sm1004877ana.2 (in reply to MAIL FROM command))
PHP's mail() function does provide a way to pass it myself, but is there a way to make it ALWAYS use -f based on which site it's serving? I ask because I really don't want to repatch Drupal every time I update it.
 
Old 07-20-2009, 11:37 PM   #4
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 206

Rep: Reputation: 32
Quote:
Originally Posted by scgtrp View Post
Thanks! That works when I use it from the command line, like this:
Code:
echo 'Test email #1240' |sendmail -f noreply@mydomain.com myemail@gmail.com
But it seems PHP doesn't pass -f to sendmail. sendmail seems to ignore that address when deciding how to authenticate, so I get this in my mail.log:


PHP's mail() function does provide a way to pass it myself, but is there a way to make it ALWAYS use -f based on which site it's serving? I ask because I really don't want to repatch Drupal every time I update it.


well try mail . instead of sendmail ,,

the last time i used Postfix i had to disable sendmail .

service sendmail stop ; chkconfig sendmail off

and you use mail command for postfix . hope this works .


Regards,
MaaS
 
Old 07-20-2009, 11:57 PM   #5
Berhanie
Senior Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 1,492

Rep: Reputation: 144Reputation: 144
There's a mail.force_extra_parameters paramter in php.ini:
Code:
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
Unfortunately, according to this,
you can't override it in an apache config (e.g. per site).
 
Old 07-20-2009, 11:58 PM   #6
Berhanie
Senior Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 1,492

Rep: Reputation: 144Reputation: 144
please ignore. posted twice by accident.

Last edited by Berhanie; 07-20-2009 at 11:59 PM.
 
Old 07-21-2009, 11:49 AM   #7
scgtrp
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Berhanie View Post
There's a mail.force_extra_parameters paramter in php.ini:
Code:
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
Unfortunately, according to this,
you can't override it in an apache config (e.g. per site).
I found that too. Didn't think of setting it per site, but if it wouldn't have worked anyway I feel no stupider. :-)

Edit: There's also sendmail_from but it's Windows-only. Where do these arbitrary restrictions come from?

Last edited by scgtrp; 07-21-2009 at 11:52 AM.
 
  


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Postfix Mail Server With Multiple Domains LXer Syndicated Linux News 0 09-22-2008 02:11 AM
Postfix sending from different domains ssfrstlstnm Linux - Server 5 04-18-2007 08:10 AM
How to make postfix accept mail from multiple domains Farthom Linux - Newbie 4 09-14-2006 11:13 AM
Postfix - how do hosted domains download their mail from my postfix franschoek Linux - Software 1 04-01-2006 09:41 PM
sendmail not sending mail to 2 existing domains dv3dv3 Linux - Software 0 07-02-2003 01:50 PM


All times are GMT -5. The time now is 06:20 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration