LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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
 
Search this Thread
Old 08-29-2008, 03:35 AM   #1
manqox
LQ Newbie
 
Registered: Jun 2007
Posts: 6

Rep: Reputation: 0
relay all non-local mail to 1 local address and NOT real destinations


I'm trying to setup a development environment for our web
application such that all emails are relayed/routed to 1 particular email address instead of their real destination email addresses.
This allows us to make sure the emails were constructed properly, count them for testing the correct number sent, etc.

The main issue is to relay all mails send by the server to one particular email address, where I can check whether the emails where sent properly by the application without reaching their destination. In real I would want the emails to reach their destination, but for testing I cannot allow this.

How can I achieve this using Sendmail?

Reagards
Manqoba Sihwa
 
Old 08-29-2008, 09:05 PM   #2
JimDog
Member
 
Registered: Aug 2003
Location: Colorado, USA
Distribution: Fedora Core
Posts: 100

Rep: Reputation: 15
I think what you need is to setup the virtual user table, found @ /etc/mail/virtualusertable

See here for more info: http://www.sendmail.org/tips/virtualHosting In particular, step 4 of the Sendmail configuration section. I believe you can do something like this:

@yourdomain.com testAccount

Then all email to any user at "yourdomain.com" will all go to user testAccount. Of course, test it out first before you send out a mass email
 
Old 09-01-2008, 04:21 AM   #3
manqox
LQ Newbie
 
Registered: Jun 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for the interest, actually I had tried configuring the virtual table and the local-host-names files, but it failed. The problem is that we have multiple foreign domains (about 3000 email addresses with different domains), so adding those will be a mission. I thought if it was possible to use the "*" character in the virtual table to forward all emails passing through to the test account. Example: *@* testacc@mydomain

The emails of particular interest are the non-local,so we want all emails reaching the server not to leave, but be forwarded to a local user account. All I want is the application to email, then the server avoids sending the messages to the real users until the test is done. No emails should leave the server during test, then when the testing is done we allow the server to send out.

Kind Regards
Manqoba Sihwa
 
Old 09-01-2008, 10:18 PM   #4
JimDog
Member
 
Registered: Aug 2003
Location: Colorado, USA
Distribution: Fedora Core
Posts: 100

Rep: Reputation: 15
Ok, I see. Yes that would be a pain to add all of those domain names by hand to the virtualtable file.

I just had a really crazy idea, but it might work. Actually I just had two.

1. Are there some emails that are "test" (the 3000) and others that aren't part of the test? If they are ALL going to be in the test app, could you not simply turn off "relaying" on sendmail. Run your test, no emails get sent anywhere, but in /var/log/mail you'd see that indeed all of the emails were sent to sendmail. That would work if the idea is to verify that the application is indeed sending to all 3000 addresses. You could even use awk or something to parse the log file and list / show you all of the emails that didn't get sent during the test.

2. Speaking of awk (this is my second idea), do you happen to have a list of all of the email addresses in a text file? If so, you could probably put together a simple awk script that would parse the list and populate the virtualtable file for you

I know, neither of these is as easy as just "* -> testAccount" but I don't know how to do that with sendmail...maybe someone else will chime in.

Good luck!
 
Old 09-03-2008, 02:16 AM   #5
manqox
LQ Newbie
 
Registered: Jun 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Sorry for the late response JimDog, apparently I like the ideas you proposed. The mission is to test my application whether its sending the emails. So I will monitor the /var/logs/maillog to see if those emails passed through. About the second one, I tried manipulating text with the "grep" command, then "awk", but I'm not extremely good on that because its tricky. All I wanted to do was grep a common pattern of domains and make sure they are not repeated. e.g
manqox:~$ less emails.txt |grep .org.za

this would display all patterns with ".org.za" , but it will repeat same domains.The "awk" command could come in here, but I failed to use it.

I hope I tried explaining it out, on the questions, there is an email.txt with a list of all emails registered. Also there are both test emails and real emails sent out.

Regards

Manqoba Sihwa
 
Old 09-03-2008, 09:52 AM   #6
cyberhydra
LQ Newbie
 
Registered: Aug 2007
Posts: 25

Rep: Reputation: 15
well. turning off mail to all those people may not be so good.

I would make a test mail for each website or domain....ifyou want to go that far...and then use it to test by sending to your self at yahoo or something. and then send back.

as long as you set up that test the same as you set up the others in that domain, then it should be fine for all of them.

The only other way to easily see if there is an issue is...

check maillog and error logs for anything involving mail errors throughout the entire day, everyday..if you see one, then you know there is a problem.

Also, a catchall for all domains to grab all mail and route to a user that can grab them all (and this will include ALL spam) and then check out the mail file for that one..

It just seems like a crazy thing to test every single mail user... must be something better you can do then do that....

You could send 3000 mails out,...one at a time using a script...to your yahoo account or something...one from each user...and see if you get it..
 
Old 09-04-2008, 04:13 AM   #7
manqox
LQ Newbie
 
Registered: Jun 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for the advice, I would also look at the Catchall suggestion although there maybe spam mail. One could have changed the Java code to email to a new group, the system needs no changes until re-deployed and about 3000 emails already exist on the database.

1. The idea is during testing my application I should add new email addresses and use them,
2. When I send mail then all mail is forwarded to me to establish who could not be receiving the emails from the system.
3. If I send 3000 then receive 2500 email, then I would know 500 emails are not been delivered. Its not like the application sends 3000 emails at once, but its the 3000 emails already in the database with different domains, which make the work tedious.

4. Receiving the emails is the best way I can test because at times you will see contents were delivered as they were sent. Currently I'm using the logs to see which emails are coming through.

Many Thanks

Manqoba Sihwa
 
  


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
Find real ip address using link local address, mdns/zeroconf dannemanare Linux - Networking 0 01-17-2008 04:31 AM
Rejecting non local mail for specific e-mail address vrsic Linux - Server 4 10-24-2006 02:46 AM
Setup local machine to allow lan machines to retrieve its local user mail. Brian1 Linux - Networking 3 03-30-2006 05:04 AM
local mail relay problem in Sendmail RajaRC Linux - Networking 3 09-15-2004 07:23 AM
Redirecting non-user mail to a local address? Trent Hatred Red Hat 2 11-19-2003 10:59 AM


All times are GMT -5. The time now is 04:16 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