Pages: 1
RSS
Outgoing mail filter to change the active account, outgoing mail filter that will change the active account to the one set up for the sender's domain
 
Hello,

I'm using The Bat! Pro 9.5.1 x64 under Windows 7 Pro (fully patched).

I own numerous domains, two of which I'll call dom1.com and dom2.com.

When I write a message as user@dom1.com, I would like it to be sent by the dom1.com account so that when the message is received, it is not signaled as spam. (I have checked this, and it works.) Of course, if I'm paying attention, before I hit the Send button, I can change the Active Account in the bottom of the Edit Mail Message window, but I often forget this critical step.

My idea, then, is to create a filter that uses RegEx to determine the sender's domain and change the active account to the one created for that domain. So, the message written by user@dom1.com would be sent by the Active Account for dom1.com.

Can an outgoing filter do this? If not, is there any way I can display a message before any message is sent to check the Active Account?

regards, AndyA
 
I don't understand why you would use a filter. The Bat would normally fill in whatever is defined as 'From' information in Account Properties | General. Don't you have the correct information there? If you want to reply from a different account, you could change the 'Reply' message template and use the %account macro there.
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Hi, Daniel. Thanks for your reply.

I'm not replying to a message, I'm sending an unsolicited message to someone. I'm not creating the message in the dom1.com account, I'm creating it in my default account. If I create a message with the from address user@dom1.com, how do I get The Bat! to use the SMTP server configured for dom1.com?

TIA for your help.

regards, AndyA
 
I see! Well, the only possible solution that I can think of (for now) is to create an Outgoing Mail filter that is triggered by a condition like 'Sender' 'Contains' 'dom1.com', and that performs an action 'Create a formatted message'. With this you should be able to create a copy of the message in the outbox of the dom1 account. Finally, with another action, you could delete the original outgoing message.. I haven't tried it, but I suspect that it might work. If it doesn't, hopefully someone who is better with filters and macros will come along with a better solution.
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
I have tried in the past to use an Outgoing mail filter to suppress a send but failed. The most I could do was display an alert and copy the message to the right account, but the message was still sent from the wrong account. If someone has succeeded, I'd like to know how the Outgoing mail filter was configured.

IAC, thanks for your help.

regards, AndyA
 
Quote
Andrew ARONOFF wrote:
I'm not replying to a message, I'm sending an unsolicited message to someone. I'm not creating the message in the dom1.com account, I'm creating it in my default account. If I create a message with the from address  user@dom1.com , how do I get The Bat! to use the SMTP server configured for dom1.com?
I think it may be solved by adding one simple line to the new message template in your default account:

Code
%If:'%FromAddr'='user@dom1.com':%Account='dom1.com'%-

Outgoing mail filter cannot help because they work only when the mail is actually sent.
Edited: Zygmunt Wereszczyński - 31 January 2023 01:51:49
 
Sorry for my delay in replying, but I'm not receiving notice of new posts in this topic (even though it's checked and greyed out).

Thanks for your post, which clearly explains how outgoing mail filters work and contains an excellent code suggestion.

However, I use many account names with my domains, so "user@dom1.com" won't work. Is there any way to adapt that line for any account name, perhaps by referring to the domain name?

%If : '%FromAddr' contains 'dom1.com' : %Account="dom1_account_name%-

or

%If : '%FromDomainName'='dom1.com' : %Account="dom1_account_name%-
 
Quote
Andrew ARONOFF wrote:
However, I use many account names with my domains, so " user@dom1.com " won't work. Is there any way to adapt that line for  any  account name, perhaps by referring to the domain name?

%If : '%FromAddr'  contains  'dom1.com' : %Account=" dom1_account_name %-
Try following line added in new message templates of every account of interest (it means accounts that you use to write messages):

Code
%If:'%RegExp("dom1\.com","%FromAddr","0")'='dom1.com':%Account='dom1_account_name'%-

Please note the backslash before the dot in regular expression!
 
Thanks for your reply. I'll add this to my new message template in my primary account, one line for each domain.
 
I'm trying to implement the line you suggested that I add to the New message template in the default account, but I'm having a problem. The New message template is used when I click on the "New Msg" icon in the toolbar. That opens a window that ignores my recipient, the message title and the message contents. The sending address is filled by the contents of Account Properties | General | From Address field.

I'll then fill in the From and To addresses and I'd like to have a macro that changes the account used to send the message based on the domain in the From field.

How do I get the line you suggested to run after I've filled in the From and To addresses in the New Msg window in the default account?
Pages: 1