[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - Changing sending account

Changing sending account

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Changing sending account

Postby SFCurley » Wed Nov 17, 2004 3:04 am

My IP address is dynamically assignged by my DSL company (Qwest). Qwest's entire block of dynamically assinged IPs is on one of the spam blacklists and AOL and Excite both use this particular list so my messages often get bounced back or sent to a spam folder.

Here's what I would like to do: when I send a message to either an aol or excite domain, have poco automatically change the account to another email account which goes from that IP address (my personal comcast account). Message would have my business email address, etc, but would be sent from my comcast account.

I've tried putting in a pre-send filter that changes the account for emails going to aol or excite, but that doesn't seem to work. Is there a way to use a script to automatically change the sending account after the message has been composed and the sent button pushed?

Thanks.
SFCurley
 

Postby Eric » Wed Nov 17, 2004 3:21 am

Have you tried doing it by creating an Outgoing filter? Just copy your pre-send filter to Outgoing. I never used the pre-send filter.
:idea: You could even use the Events OnReply or OnCompose for a certain mailbox(es).

I don't think you need a script to do this, but if someone has another suggestion ...

I hope this helps. :wink:
Eric
 

Postby SFCurley » Wed Nov 17, 2004 3:32 am

Eric, Thanks for your reply. I should have been more accurate. I did use an Outgoing filter and that had no effect. Not sure how I would trigger the OnEvent or OnReply for just new emails to aol or excite.
SFCurley
 

Postby Eric » Wed Nov 17, 2004 3:44 am

SFCurley wrote:Eric, Thanks for your reply.
You're welcome. :wink:
Not sure how I would trigger the OnEvent or OnReply for just new emails to aol or excite.
Take a look at this topic.
Eric
 

Postby Jay Sears » Wed Jan 26, 2005 6:53 am

You can never be sure with PocoScript, but I don't think it is possible to change the account when a message is sent. I tried and tried, and failed. But I did find a way around the problem: Change the "From" and "Reply-To" headers. Here's the script I use:

Code: Select all
{ Script to be used on outgoing mail
{ Forces sender to be 'Raccoon' if recipients include 'Rabbit' and/or 'Rat'

{ Bail out if something goes wrong
Set $OnErrorGoTo Quit

{ Only run on outgoing mail
If #PocoScriptMode ! 2 Then Quit

{ from 'Raccoon' is always ok
ReadHeader $from "From:" %message
ExtractEmail $from
Lowercase $from
If $from = "raccoon@riverbank.net" Then Quit

{ Read the To: line in the header
ReadTo $allPrimaries %message
LineCount #num $allPrimaries
Set #counter 0

:Loop

Set $check ""

GetLine $singleAddress #counter $allPrimaries

ExtractEmail $singleAddress
Lowercase $singleAddress

{ If it is a hit fix the 'From:' and 'reply-To:' headers
If $SingleRecip = "rabbit@petfarm.net" Then Fixit
If $SingleRecip = "rat@dumpster.com" Then Fixit

Inc #counter
If #counter < #num Then Loop
Exit

:FixIt
DeleteHeader "From:" %message
AddHeader %message "From:" "Raccoon <raccoon@riverbank.net>"
DeleteHeader "Reply-To:" %message
AddHeader %message "Reply-To:" "Raccoon <raccoon@riverbank.net>"
Exit

:Quit
Exit


Be careful when you copy-and-paste: lines may have been wrapped.

I hope this helps.

Jay

Edit by Robin: script put into code tags
Jay Sears
Drop-in Visitor
 
Posts: 9
Joined: Tue Nov 02, 2004 5:08 am

Re: Changing sending account

Postby Irene » Wed Jan 26, 2005 12:33 pm

SFCurley wrote:My IP address is dynamically assignged by my DSL company (Qwest). Qwest's entire block of dynamically assinged IPs is on one of the spam blacklists and AOL and Excite both use this particular list so my messages often get bounced back or sent to a spam folder.

I'm in the same situation and I've been using two scripts for several months that solve the blocked IP address problem for me. However, I'm not sure if my scripts will achieve what you want to do. Need more info...

Here's what I would like to do: when I send a message to either an aol or excite domain, have poco automatically change the account to another email account which goes from that IP address (my personal comcast account). Message would have my business email address, etc, but would be sent from my comcast account.

What is the intended purpose of changing the "account"? Is the purpose so that your outgoing message will be sent through comcast's mail server (SMTP server)? If yes, then my scripts may work for you, but if there's some other reason for changing the account then they won't.

I've tried putting in a pre-send filter that changes the account for emails going to aol or excite, but that doesn't seem to work. Is there a way to use a script to automatically change the sending account after the message has been composed and the sent button pushed?.

I could not get an outgoing filter/script to work for this sort of purpose and if I recall correctly I couldn't get an OnCompose or OnReply event to do what I wanted either. However, I did find that using an "Adding message to a Mail Box (OnAdd)" event works - I set the OnAdd event to operate only on adding a message to the Draft mailbox, which automatically happens every time one starts a new message or replies to a message.

My OnAdd event script checks the "To" field of the message I'm writing and if it's to a domain that I know blocks mail from dynamic IPs, then the script changes the default SMTP server to a specified ISP's mail server, so the message gets sent through that server. I also have a Post-Send filter that runs after every message has been sent to check whether the default SMTP server was changed and if it was, then change it back to my preferred default server.

Note that the way these scripts work assumes that one will type a message and send it straight away. If one types a message and then leaves it saved in the draft mailbox for sending at some later time, then the script probably won't achieve its purpose because if one sends any mail to anyone else first, the default server will be restored by the post-send filter/script. (It might work if/when one later edits the draft message because Poco re-saves drafts every minute which would trigger the OnAdd event again, however, I don't think I've ever tried that).

If the above sounds like it may achieve what you want to do, let me know and I'll be happy to post the scripts.

Irene
Irene
Frequent Visitor
 
Posts: 50
Joined: Sun Nov 14, 2004 10:01 am

Postby Michael » Wed Jan 26, 2005 4:53 pm

To change the account you need to change the "X-Account" header as follows:
Code: Select all
 DeleteHeader "X-Account:" %m
AddHeader %m "X-Account:" $line


This may not achieve what you are after but it is the method for changing accounts on outgoing messages.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby SFCurley » Thu Jan 27, 2005 3:27 am

In the end, I found the best solution for me was to pay an extra $5/month to get a statically assigned IP address. This one is not on any blacklist.
SFCurley
 


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron