[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 - Script to create Mailbox with senders

Script to create Mailbox with senders

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Script to create Mailbox with senders

Postby elmagox » Fri Jan 21, 2005 1:56 am

Hello,

Is it possible to create a script were all incoming mail would automatically create a New sub-Mailbox for each sender? It would create a new mailbox for every new sender from the contacts and/or new senders and group mails there. We would have all mails from all senders grouped into their own respective Mailbox.
If so can any one share this utility.

Thanks
Pedro Sanchez Jimenez
elmagox
Drop-in Visitor
 
Posts: 9
Joined: Fri Oct 08, 2004 3:46 pm
Location: Spain

Postby gert » Fri Jan 21, 2005 1:59 pm

I am using the following scripts for communication with my customers.
It only works for adresses that are in my "customers" address book, and will create a mailbox (and put messages in it), named
"Customer Communication\<first letter of domain>\<domain>

Code: Select all
{### Customers to special mailbox

{ get the sender from this message
ReadHeader $Adres "From:" %message

{ get the senders domain (a@b.com -> b.com)
Set $Domain $Adres
ExtractEmail $Domain
StringPos #aap "@" $Domain
ChopString $Domain 1 #aap
{ now we have b.com, strip .com from it
StringPos #aap "." $Domain
ChopString $Domain #aap 600
{ first character of the domain name
Set $c1 $Domain
ChopString $c1 2 600
Lowercase $c1

Set $MB "Customer Communication"
AddStrings $MB \ $c1 \ $Domain

IsAddressPresent &IsCust $Adres "Customers"
if &IsCust then DoTheMove

exit


:DoTheMove
SaveMessage %message $MB
DeleteMessage %message
exit

I let the above script run for all incoming messages.
The script below will put my messages and replies to those customers in the same mailbox:

Code: Select all
{### Replies to Customers to special mailbox

{ get all the "To" fields
ReadTo $To %message
LineCount #NumTo $To

{MessageBox "check srv"
{MessageBox "check cust"
Set &doalf 1
Set &dosub 1
Set $Book "Customers"
Set $Target "Customer Communication"
Call CheckSpecial

exit


:CheckSpecial
Set #Index 0
:Loop

GetLine $Line #Index $To
IsAddressPresent &IsCustomer $Line $Book
If &IsCustomer Then DoMove

Inc #Index
If #Index < #NumTo Then Loop

return

:DoMove
if &dosub then changeTarget
SaveMessage %message $Target
DeleteMessage %message
exit


:changeTarget
{ get the senders domain (a@b.com -> b.com)
Set $Domain $Line
ExtractEmail $Domain
StringPos #aap "@" $Domain
ChopString $Domain 1 #aap
StringPos #aap "." $Domain
ChopString $Domain #aap 600

if &doalf then targMetAlfa
AddStrings $Target \ $Domain
call dodesave

:targMetAlfa
{ first character of the domain name
Set $c1 $Domain
ChopString $c1 2 600
Lowercase $c1
AddStrings $Target \ $c1 \ $Domain

:dodesave
SaveMessage %message $Target
DeleteMessage %message
exit

:PocoError
exit


Good luck,
Gert
gert
Poco Tourist
 
Posts: 43
Joined: Sun Jul 25, 2004 4:20 pm

Postby Hogyt » Fri Jan 21, 2005 1:59 pm

Edit: Script removed. Use Michaels in the link below! :D
Last edited by Hogyt on Sat Jan 22, 2005 12:50 am, edited 1 time in total.
Mat
Hogyt
Poco Enthusiast
 
Posts: 241
Joined: Thu Jul 29, 2004 11:22 am
Location: England

Postby Michael » Fri Jan 21, 2005 5:09 pm

You might also want to take a look at the SaveByBook script.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 3 guests

cron