Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Changing the recipients of a message
PostPosted: 2011-07-14 12:11 
New user
New user

Joined: 2011-07-13 11:05
Posts: 5
Is there a way to change the recipients of a message without changing the "TO" and "CC" headers of the message?

Background:
I use hMail to relay emails sent by a specific application to our internal mail server. However, when testing I don't want that emails automatically generated by the application are delivered to the "real" users because that will confuse them. Thus my idea is to add a script for the "OnAcceptMessage" handler which checks the recipient list and replaces the email addresses for recipients that are not designated as "test user" (i.e. not listed on some kind of list of users involved in testing) by a specific email address (e. g. "test-application@mydomain.com"). However, in order to be able to check if the correct users has been supplied in the messages originally generated by the application, it would be helpful, if the "To" and "CC" headers are left unchanged.

Until now ,I only know how to clear the whole recipient list. Unfortunately, this also clears the "TO" and "CC" headers. And I also don't know a way to add "TO "and "CC" headers again using the hMail COM API.

Many thanks in advance for any hints,
AnDi


Top
 Profile  
 
 Post subject: Re: Changing the recipients of a message
PostPosted: 2011-07-14 15:53 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 9385
Location: 'The Outback' Australia
how about just block port 25 outbound at your firewall, and then none of the mail will be delivered, it will remain in the queue

Or just pull the networking cable out..

_________________
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
Documentation


Top
 Profile  
 
 Post subject: Re: Changing the recipients of a message
PostPosted: 2011-07-14 17:52 
Developer

Joined: 2010-04-24 23:16
Posts: 4803
Location: Michigan, USA
Hey AnDi,
When I am running a test server & want to ensure email doesn't 'escape' into the wild I just set SMTP Relayer to IP that can't accept mail such as my router's IP. To be extra safe can set the port to something besides 25 that another server wouldn't be waiting for mail on & make it almost impossible for mail to leak..

Then Routes can be made to allow mail out for specific domains (like if I want to test to yahoo I do mx lookup to find a host of theirs & add a route) for testing. On other hand can block specific domains with a fake/crippled route too using same technique.
Bill

_________________
hMailServer build I'm using LIVE on my servers: 5.4-B2013040501
Latest test builds at: http://www.hmailserver.com/forum/viewtopic.php?f=10&t=21420


Top
 Profile  
 
 Post subject: Re: Changing the recipients of a message
PostPosted: 2011-07-15 08:24 
New user
New user

Joined: 2011-07-13 11:05
Posts: 5
First, thanks for all your feedback. But as far as I understood, all your proposals would block sending emails at all or at the domain level, but not at the user level.

The requirement I shall fulfill is that certain users (those involved in the test campaign) will receive the emails so that they can check if emails are correctly (regarding recipients as well as content) generated on certain events. However, users not involved in the test campaign shall not receive any emails. To make things even more complicated this behaviour shall also be enforced, when users involved as well as users not involved in the test campaign are assigned as recipients of the same message (i.e. are mixed in the "To" and/or "CC" headers).

Regards,
AnDi


Top
 Profile  
 
 Post subject: Re: Changing the recipients of a message
PostPosted: 2011-07-15 09:47 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 9385
Location: 'The Outback' Australia
Then this should work....
Bill48105 wrote:
Then Routes can be made to allow mail out for specific domains (like if I want to test to yahoo I do mx lookup to find a host of theirs & add a route) for testing. On other hand can block specific domains with a fake/crippled route too using same technique.


You can add a recipient without changing the TO or CC headers, but this doesn't stop the original recipients from getting the mail.

If you want to stop specific addresses or all addresses from getting mail that is addressed to them, you need to do something to stop that delivery.
A route is one way within hMailserver. Set a route to a non-existent or controlled address.

_________________
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
Documentation


Top
 Profile  
 
 Post subject: Re: Changing the recipients of a message
PostPosted: 2011-07-16 20:20 
Developer

Joined: 2010-04-24 23:16
Posts: 4803
Location: Michigan, USA
lgtandi wrote:
First, thanks for all your feedback. But as far as I understood, all your proposals would block sending emails at all or at the domain level, but not at the user level.

The requirement I shall fulfill is that certain users (those involved in the test campaign) will receive the emails so that they can check if emails are correctly (regarding recipients as well as content) generated on certain events. However, users not involved in the test campaign shall not receive any emails. To make things even more complicated this behaviour shall also be enforced, when users involved as well as users not involved in the test campaign are assigned as recipients of the same message (i.e. are mixed in the "To" and/or "CC" headers).

Regards,
AnDi

As I said if you want an easy way to stop all mail set smtp relayer or routes to function as you want but yes that is at most granular to domain level. For per-user blocking or manipulation you'd need to resort to rules or likely scripts if you want more control over it all in which case is probably going to require a be a bit of effort on your part.
Bill

_________________
hMailServer build I'm using LIVE on my servers: 5.4-B2013040501
Latest test builds at: http://www.hmailserver.com/forum/viewtopic.php?f=10&t=21420


Top
 Profile  
 
 Post subject: Re: Changing the recipients of a message
PostPosted: 2011-07-18 16:59 
New user
New user

Joined: 2011-07-13 11:05
Posts: 5
I am currently working with the following setup in order to ensure that only designated users within a domain mydomain.com will receive emails during testing:

  1. I have created within hMail a domain test.mydomain.com. For that domain, a catch-all address like catch-all@test.mydomain.com is defined.
  2. For each user which shall receive emails, I have created an account user@test.mydomain.com for which forwarding to user@mydomain.com is enabled (this is also configured for catch-all@test.mydomain.com).
  3. For the "OnAcceptMessage" event I have created a script that replaces all recipients from mydomain.com with the equivalent recipients in test.mydomain.com.

This allows me to define on a per-user level, which user shall receive emails. The drawback is that the "To" and "CC" headers of the original email message are destroyed.

However, as suggested I would like to use routes since it would be more intuitive to define the allowed users there. Unfortunately, I found no way to catch all emails sent to users not listed in the addresses section of the route and route them to a catch-all address. Does anybody know a way to accomplish this?

Kind regards,
AnDi


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


Who is online

Users browsing this forum: No registered users and 2 guests



Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group