[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 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 - Get Email Address from body to to:

Get Email Address from body to to:

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Get Email Address from body to to:

Postby ente » Fri May 02, 2008 8:26 pm

Hello,
with the help of the auto replay script which came with Poco I created a few years ago about a dozen scripts for specific needs and all of them work fine.
Now I get a email, for which I havn't been able to find the solution I need.

The email I have to answer brings within the body after a first
"E-Mail: " my mail address
and only after the 2nd E-Mail: comes the mail address needed.

Thats why my old solution (see below) doesn't work:

Code: Select all
set #ll -1
LocateLine #ll "E-Mail: " $b
if #ll > -1 then ADR
goto DGP
:ADR
GetLine $t #ll $b
ChopString $t 1 8
AddTo %m $t

What I would need is somthing like

locate line with "E-Mail: " where string after E-Mail: is not "xxxl@xxxxxx.xx"
and copy this to to:

can anybody help?
Thanks, Ente
Last edited by ente on Mon May 05, 2008 12:49 am, edited 1 time in total.
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Re: Get Email Address from body to to:

Postby MarkB » Sat May 03, 2008 2:56 am

ente wrote:What I would need is somthing like

locate line with "E-Mail: " where string after E-Mail: is not "xxxx@xxx-xxxx.ch"


Hello, Ente. How's beautiful Zurich today?

Have a look at this:

Code: Select all
Set $address ""
ReadBody $body %message
LineCount #i $body
{ Lines are numbered 0..n-1
:FindLoop
Dec #i
If #i < 0 Then ExitFindLoop
GetLine $line #i $body
StringPos #j "Email: " $line
If #j < 1 Then FindLoop
StringPos #j "xxxx@xxx-xxxx.ch" $line
If #j > 0 Then FindLoop
{ At this point, the string $line contains "Email: "
{ and not "xxxx@xxx-xxxx.ch"
MessageBox $line
:ExitFindLoop


Edited to disguise email addresses
Last edited by MarkB on Sun May 04, 2008 7:14 am, edited 1 time in total.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Get Email Address from body to to:

Postby ente » Sat May 03, 2008 3:39 am

MarkB wrote:
ente wrote:What I would need is somthing like

locate line with "E-Mail: " where string after E-Mail: is not "xxxll@xxxxx.xx"


Hello, Ente. How's beautiful Zurich today?

Have a look at this:

Code: Select all
Set $address ""
ReadBody $body %message
LineCount #i $body
{ Lines are numbered 0..n-1
:FindLoop
Dec #i
If #i < 0 Then ExitFindLoop
GetLine $line #i $body
StringPos #j "Email: " $line
If #j < 1 Then FindLoop
StringPos #j "xxxx@xxx-xxxx.ch" $line
If #j > 0 Then FindLoop
{ At this point, the string $line contains "Email: "
{ and not "xxxx@xxx-xxxx.ch"
MessageBox $line
:ExitFindLoop


Hello MarkB,
thank you. Weather- outside - is fine today (yesterday and the day before it was not raining but pouring (or pooring??)

Inside (on the screen) it's clearing up, but not yet clear... :wink:

I have replaced my stuff by your stuff
and get now the message
"Variable not previously decleared: $userfile1."

Where have I to do what?
Ente
Last edited by ente on Mon May 05, 2008 12:50 am, edited 1 time in total.
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sat May 03, 2008 4:03 am

Ente,

The code I posted is a demonstration of a way to find a line that contains "Email: " but not "xxxx@xxx-xxxx.ch". I was hoping that you could modify your existing script to incorporate the demonstrated ideas. :) If you want help with that, please post the script here.

For an explanation of $userfile1, see PocoScript Help under "External."
Last edited by MarkB on Sun May 04, 2008 7:15 am, edited 1 time in total.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Sun May 04, 2008 1:57 am

MarkB wrote:Ente,

The code I posted is a demonstration of a way to find a line that contains "Email: " but not "xxx@xxxxx.xx". (...) If you want help with that, please post the script here.

For an explanation of $userfile1, see PocoScript Help under "External."


Hello MarkB,

Zurich not only has plenty of sunshine today, but everybody is happy - they learned that my script is - thanks to you - running smoothly now.
Many thanks, Götz


Here it is:


Code: Select all
External $userdata1 "Choose a character to quote message with:" ">"
External $userdata1 "Choose a character to quote message with:" ">"
External $userdata1 "Choose a character to quote message with:" ">"
{### Reply to Mail from ZVAB with Template
{----------
{v1.2 - 2008.05.04 - Roger Leemann / Götz Perll and
{ the help of MarkB and making use of "Reply with Template"
{----------
{ This script will reply to a message from a saved template
{ Usage: not suitable for automatic use; use only on demand.

    { Initialize user settings: }
External $userdata1 "Choose a character to quote message with:" ">"
External $userfile1 "Create body template" "ZvabStdRpl.txt"

CreateMessage %m
ReadHeader $a Subject %message
AddStrings $subject "Bestätigung der "
AddStrings $subject $a
SetHeader %m Subject $subject

OpenBody $Body $userfile1
ReadHeader $From From %message
{AddTo %m $From}

    { If template file exists load it }   
FileExists &F $userfile1
if &F then UseBody

    { Otherwise, use a blank template }
Set $a "MESSAGE BODY TEMPLATE CURRENTLY NOT SET"
AppendBody $a " "
AppendBody $a " "
AppendBody $a "To use this script, please setup a default message body template:"
AppendBody $a " "
AppendBody $a "    press F9 to open Filters and Scripts window, then click on Setup Script."
AppendBody $a "    From the drop down box select script "Reply with Template"."
AppendBody $a "    Click on the Create Body Template button to create a template."
AppendBody $a "    When done, just click on File, Save."
goto Edit

:UseBody
set $a $Body

:Edit
ReadBody $b %message

{v1.0 delete certain lines with information that the adresseee shouldn't see

LineCount #i $b
{ Lines are numbered 0..n-1
:FindLoop
Dec #i
If #i < 0 Then ExitFindLoop
GetLine $line #i $b
StringPos #j "E-Mail: " $line
If #j < 1 Then FindLoop
StringPos #j "aaa@aaa-aaa.ch" $line
If #j > 0 Then FindLoop
StringPos #j "bbb@bbb-bbb.ccm" $line
If #j > 0 Then FindLoop
{ At this point, the string $line contains "E-Mail: "
{ and not "aaa@aaa-aaa.ch" or "bbb@bbb-bbb.com"
ChopString $line 1 8
AddTo %m $line
:ExitFindLoop

:DGP
set #ll -1
LocateLine #ll "Bestellung über ZVAB bei:" $b
if #ll > -1 then DL1
goto FL2
:DL1
DeleteLine $b #ll 12

:FL2
set #l -1
LocateLine #ll "Zum Bearbeiten" $b
if #ll > -1 then DL2
goto FL3
:DL2
 DeleteLine $b #ll 2

:FL3
set #ll -1
LocateLine #ll "Diese Bestellung wurde" $b
if #ll > -1 then DL3
goto FL4
:DL3
DeleteLine $b #ll 21

:CONT
QuoteBody $b $UserData1
AppendBody $a " "
AppendBody $a $b
AssignBody %m $a
appendsignature %m
EditMessage %m
MarkMessage %message 2


And this is what it does. When I get an email to which I want send an answer but where in FROM: is not the address of the people to which I want to send the mail, it looks in the body for the address to use.
Since in the body is mentioned not only my clients E-Mail address, but also my address (xxxx@xxx-xxxx.ch) and also the one of the company from which I received the mail (xxxx@xxx-xxxx.com) the part of the script which starts with

LineCount #i $b

and ends with

:ExitFindLoop

keeps the script from selecting these two addresses, which are not needed, and selects the one to which I wish to send my confirmation.

Furthermore some standard text in which I say thank you for the order and recomand my own homepage. etc. is entered
with

External $userfile1 "Create body template" "ZvabStdRpl.txt"

And at several place some of the text transmitted from ZVAB to me, which my client does not need to see and/or takes only lots of paper when printed, is deleted with this:

Code: Select all
:DGP
set #ll -1
LocateLine #ll "Bestellung über ZVAB bei:" $b
if #ll > -1 then DL1
goto FL2
:DL1
DeleteLine $b #ll 12


The last line of the script gives the incoming mail a specific colour to let me know that it has been answered:

MarkMessage %message 2

~ Masked email adresses & added code tags ... Eric ~
Last edited by ente on Mon May 05, 2008 7:45 am, edited 2 times in total.
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sun May 04, 2008 7:30 am

That's good news, Götz. You must go to the store seven days a week!

We should both go back and disguise or remove the email addresses in the earlier posts, to thwart spambots. I forgot about that. :oops:
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Sun May 04, 2008 3:53 pm

MarkB wrote:That's good news, Götz. You must go to the store seven days a week!

We should both go back and disguise or remove the email addresses in the earlier posts, to thwart spambots. I forgot about that. :oops:


Both? What have I to do where?
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sun May 04, 2008 10:03 pm

ente wrote:What have I to do where?

Look at each of your posts on this page, click the "Edit" button, and replace all email addresses with nonsense addresses such as xxxx@xxx-xxxx.ch.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Sun May 04, 2008 10:53 pm

MarkB wrote:
ente wrote:What have I to do where?

Look at each of your posts on this page, click the "Edit" button, and replace all email addresses with nonsense addresses such as xxxx@xxx-xxxx.ch.


MarkB,
where is that bl... Edit button? Is it hiding because I use Firefox?
Actually somebody was doing it while I was online - exept in my first mail...
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Mon May 05, 2008 12:29 am

ente wrote:where is that bl... Edit button?

When you are logged in, it is next to the Quote button, which is in the upper righthand corner of any of your own posts.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby Eric » Mon May 05, 2008 6:58 am

ente wrote:Actually somebody was doing it while I was online - exept in my first mail...
That should be me Götz.
Missed one. :oops:
Last edited by Eric on Mon May 05, 2008 7:55 am, edited 1 time in total.
Eric
 

Postby ente » Mon May 05, 2008 7:42 am

Eric wrote:
ente wrote:Actually somebody was doing it while I was online - exept in my first mail...
That should be me Götz.
Missed one. :oops:


Eric, I'm glad your where over all (but one) faster then I....

Can you help: I wanted the complete script make more precise by entering two dfifferent fake addresses - but now the edit button is gone again - where to??
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby ente » Mon May 05, 2008 7:49 am

ente wrote:
Eric wrote:
ente wrote:[Actually somebody was doing it while I was online - exept in my first mail...
That should be me Götz.
Missed one. :oops:


Eric, I'm glad your where over all (but one) faster then I....

Can you help: I wanted the complete script make more precise by entering two dfifferent fake addresses - but now the edit button is gone again - where to??


Eric, after submitting the above - the edit button was back. I guess, from now on I will not forget anymore how it works...
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby Eric » Mon May 05, 2008 7:53 am

ente wrote:Eric, I'm glad your where over all (but one) faster then I....
:lol:
Can you help: I wanted the complete script make more precise by entering two dfifferent fake addresses - but now the edit button is gone again - where to??
Just send me a PM with the information, so I'll edit that post for you to make the necessary adjustments. :wink:

I wonder why you can't see the Edit button or is it restricted in time :?:
Eric
 


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron