LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-02-2012, 10:25 AM   #1
mason188
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Rep: Reputation: Disabled
changes to a relayed email using sendmail


Ok here is the issue. The previous programmer created a program so when there is a change in a customers database, an email gets generated on a windows box from lets just say test@mason.com and gets delivered to test1@foo.com and test2@foo.com...

That programmer has left and the mail server he was using to send these emails went down so I switched it so that the emails are relayed using my linux box running sendmail.

The problem is that his email distribution list is hard coded and I have an executable and no source code, so I can't change test1@foo.com and test2@foo.com...I need to add a third email address test3@foo.com.

Rather than rewrite his entire program which is a lengthy project, is there an easy way so that when this particular email arrives at my mail server, also send it to test3@foo.com? Thanks.

Last edited by mason188; 07-02-2012 at 10:32 AM.
 
Old 07-02-2012, 12:03 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,883

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Hi,

You can use procmail for this. Promail is a MDA (mail delivery agent) and it comes usually with sendmail in order to deliver mail in user's mailbox.
You can create/edit /etc/procmailrc and use:
Code:
:0
* ^FROM.test@mason.com
!test3@foo.com
Regards
 
Old 07-02-2012, 12:33 PM   #3
mason188
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi Bathory,

Thanks for your reply...I have tried this but procmail doesn't appear to be looking at these messages because they are not destined for a local user...

I have local_procmail defined in my sendmail.mc as a feature. When I send a message to a local user, your code works fine just like it should. But for the relayed message the program is sending, it's not being forwarded.

I'll try and explain it in an example:

mason.com (customers domain)
foo.com (another customers domain)
test.com (my linux box's domain)

So the program sends email from mason.com to foo.com using my mail server as the relay...I have the sending computers IP address in my sendmail access file and set to RELAY. It works fine. I added your procmail code to my /etc/procmailrc. Messages from test@mason.com are sent to foo.com, but they do not got forwarded to test3@foo.com. However if I send a message from test@mason.com to info@test.com, they get forwarded to test3@foo.com no problem. I hope that makes sense

Thanks!
 
Old 07-02-2012, 01:59 PM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,883

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
What is the mailserver running on foo.com? Can you mess with it and do something similar to the above?
If not, the only other way I can think of, is to configure your sendmail box as the MX host for foo.com. Of course you have to contact the admin of the authoritative dns of foo.com to do this.
So you can get the mail for foo.com locally, do your stuff with sendmail/procmail and then use for example mailertable to forward mail to the final mta at foo.com.
 
Old 07-02-2012, 03:17 PM   #5
mason188
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
No I dont have access to the mailserver running at foo.com but I wish I did...I think I am just going to rewrite the original program, I just figured there would be an easy way to forward a relayed email that is going through my own server originating from the same address (test@mason.com), but I don't want to mess around too much and mess something up. Thanks for your input.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I save Sendmail relayed mqueue messages? MensaWater Linux - Server 1 07-17-2012 05:36 PM
'trapping' relayed messages turbo_acura Linux - Networking 0 03-27-2009 05:26 AM
Adding relayed subnets in DHCP archangel_617b Linux - Networking 4 10-30-2008 04:49 PM
My Email Server is Being Spoofed / Relayed carlosinfl Linux - Server 8 03-31-2008 07:32 AM
Creating A Second Email Address For Email Account On Sendmail treedstang Linux - Software 1 04-27-2004 10:31 PM


All times are GMT -5. The time now is 02:47 PM.

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 Google+: linuxquestions
Open Source Consulting | Domain Registration