Pages: 1
RSS
Reply only part of the e-mail (not F4), Is there any way to automatic reply only part of an e-mail?
 
I have many forms on my web site who are for automatic replyes.
The user fill the form, my server send it to me and my e-mail program is supose to automatic reply a pre-formated response.
I'm using 'Quick Templates' to do it.
Now I would like to see if I can go a step furter:

On the reply e-mail, I only want part of the original sender message. On the original mesage it cames with a lot of info which should not be sent back to the sender, like sender's IP number, the web page the sender was when the sent the message, the time stamp, and other info.
I can manipuleate my form to insert things line a "-----" and then I was wondering if I could create an automatic reply to only reply te text between two "------".

Is it possible? A selective reply, (like when we use F4) but automaticly?

Thank you
----
 
Yes, that can be done. The way to do that is with regular expressions.
When you take care of the format of your messages, you can pick lumps of text as individual parameters.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Quote
Yes, that can be done. The way to do that is with regular expressions.
When you take care of the format of your messages, you can pick lumps of text as individual parameters.

Would you mind to give me one example, so I can learn from that?
Like the original e-mail, and how you create the filter?

Thank you
----
 
Here's an example. The regexp takes dat from the original message and palces that in the to header of the reply:

%SetHeader('To','"%SetPattRegExp=_(?is)(.*?)E-mail:\s(.*?)\s(.*?)Fornavn(.{3})(.*?)\nEfternavn(.{3})(.*?)\n_%-
%RegExpBlindMatch=_%Text_%-
%SubPatt=_5_ %SubPatt=_7_" <%SubPatt=_2_>')%-


The message looks like this:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
(empty line)
E-mail: username@domain.dk
har tilmeldt sig

Subscribe page: 1
Fornavn = Firstname
Efternavn = Lastname

List Membership:

 * Gratis Tips&Tricks

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Hello Roelof,
Sorry to bring it back to life after 3 months.
Still I could not be able to figure out how you do that with the templates function.
I'm kind now to TheBat (still) and I guess I'm missing something here.

Let me try to explain my problem the best way so if you can help me one more time would be easy.

this is the e-mail I'm receiving, trhu a form from my web site. It means ALL e-mails will be in the same format:

Subject: Information about widgets
Name: Steve Smith
Email: steve@mail.com
State: CA
Country: U.S.A.
-----------
ip: 69.228.136.71
httpref: http://www.mysite.com/contact.html
httpagent: Mozilla/5.0



So, this is a start e-mail I will receive, where the  "Subject" will be  a multiple choice, so ALWAYS will be a pre-formated with one of my  4 options.

What I want to do is this:

Send an automatic replay every time I receive one e-mail, where the TheBat will read the 'Subject' sending an expecific reply accordly to that, BUT:
the replay will cot the last 3 lines (IP, httpref, httpagent) based on that line with 11 '-'.

I'm almost sure it can be done with TheBat, but could not figure out how to 'split' the current 'body' and reply only the first part of the '-----------'.

Do you have any ideas on it?

Thank you
----
 
Can be done.
Give me one messgae as example, as I need the exact wording of the first of the three lines that you need to be cut.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Hello Roelof,
The exemple I post on the second message is exactly what I'm receiving on the e-mail:
-=-=-=-=-=-=-=-=-=-
Subject: Information about widgets
Name: Steve Smith
Email: steve@mail.com
State: CA
Country: U.S.A.
-----------
ip: 69.228.136.71
httpref: http://www.mysite.com/contact.html
httpagent: Mozilla/5.0
-=-=-=-=-=-=-=-=-=-=-

Note that the 11 '-' are what will separete what I want to reply (the top part) from what I don't (the botton part with ip, httpref, httpagent and else)


thank you

----
 
Sorry for replying late, but I forgot about it and was just remembered by a similar question somewhere else.
This will do what you asked, simply returnig the part of the message before the eleven dashes:

%SetPattRegExp='(?is)(.*?)-{11}\n(.*?)'%-
%RegExpBlindMatch='%Text'%-
%SubPatt='1'

It's also possible to use the data listed as name and address for addressing the message and use the subject part of the message to set the subject of your return message. That would make the regular expression just a little more complicated.
You'd get something like this:

%SetPattRegExp='(?is)Subject:\s(.*?)\nName:\s(.*?)\nEmail:\s(.*?)\n(.*?)-{11}\n(.*?)'%-
%RegExpBlindMatch='%Text'%-
%Subject="%SubPatt='1'"%-
%To=""%To=_"%SubPatt='2'" <%SubPatt='3'>_%-
Hello %SubPatt='2',

You're subscribed to our mailing list '%SubPatt="1"' with these data:
Name:  %SubPatt='2'
Email: %SubPatt='3'
%SubPatt='4'
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
i don't get it. where in the regular expressions do you make the e-mail client to read the mail and where do you make it to send the reply?
maybe i missed something?
i am about to create an automatic reply if i get e-mail from a specific e-mail address (something like thank you after filling a form/registering and to inform the user that his enetered data were read)
 
The regular expressions don't read the mail and don't perform any actions. What you're doing in this case is create a filter with a condition that decides when you want to reply. (One of the four possible subject lines.)
As action for that filter you set 'create a reply', for that reply you can define a template. That template contains the regular expressions to take of (part of) the contents of your reply. Just like any other macro that you insert in a template.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Am looking for a macro which I can use to give all outgoing emails from a particular email account a Ref Number.....like HOPP0000234 or something of this sort.Pleased to hear if any one can help.Thanks in advance

 
I created a template that does that for somebody else, so I had this laying around:

Your desired action can be split in four sub-actions.
1) Get a number from storage.
2) Add 1 to your number
  TB can do this with the %Calc macro
3) Insert the new result in your message
  TB can insert your number in the body, the subject or whatever via
  a template.
4) Overwrite the file with your old number by one with the new number.
  TB can do this in an outgoing filter, not in a template. This means
  that you've got to send message 1000, before you can start message
  1001 or message 1001 and will have the same reference as 1000.
  So: No composing of multiple messages at the same time.

When the composing of multiple messages at the same time is preferred,
you'd need a plug-in. My suggestion would the MyMacros plug-in by
Andrew Perevodchik. It can be downloaded from:
http://en.barin.com.ua/soft/mymacros/
IIRC this site is currently unavailable, but the plug-in can be downloaded somewhere from the Ritlabs site.

This has the added advantage that it uses the registry, so you won't
need a file, but merely a key in the registry.

As the latter is the most elegant, here's a macro sequence that does what you
want. You have to add these lines to every new message-, reply- and
forwarding template you're using. Of course yu can insert it into a
Quick Template and call that QT with the QInclude macro, but then that
has to be added to every template. You'll need to install the MyMacros
plug-in to make it work. It uses this registry key (peviously unknown to TB):
HKEY_CURRENT_USER\Software\RIT\The Bat!\MessageReferenceNumber
Look into the MyMacros help file how to install the plug-in.First you create a new header for TB:
 Options -> Preferences -> Messages headers -> Add
                                               Display header as: MsgRef
                                               RFC 2822 name: X-TB-MsgRef




Now create a quick template (QT) called MsgRef like this:
                                               
%ModifyOnce(X-TB-MsgRef)%-
%SetHeader(&X-TB-MsgRef&,&%-
%Calc('%RegRead("HKEY_CURRENT_USER\Software\RIT\The Bat!\MessageReferenceNumber", "0") + 1')%-
&)%-
%_RefNo='%Header(X-TB-MsgRef)'%-
%If:'%_RefNo'='99999999':'%_RefNo="0"'%-
%RegWrite("HKEY_CURRENT_USER\Software\RIT\The Bat!\MessageReferenceNumber", %_RefNo)%-
Msg-Ref: %_RefNo

Whenever you need a ref number you can call this QT with the macro %QInclude(MsgRef) you can insert this macro in your templates.

Now wherever you need to insert your reference number you can put %_RefNo in your templates.


I've copied and pasted from a few different messages, as this project was developed during a couple of messages, complete with bugfixes an add-ons. If something isn't clear, please tell me what's the problem exactly, because with complaints like "I don't get it" it's very hard to explain.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Quote
Roelof Otten writes:
Sorry for replying late, but I forgot about it and was just remembered by a similar question somewhere else. This will do what you asked, simply returnig the part of the message before the eleven dashes:

%SetPattRegExp='(?is)(.*?)-{11}\n(.*?)'%- %RegExpBlindMatch='%Text'%- %SubPatt='1'

It's also possible to use the data listed as name and address for addressing the message and use the subject part of the message to set the subject of your return message. That would make the regular expression just a little more complicated. You'd get something like this:

%SetPattRegExp='(?is)Subject:\s(.*?)\nName:\s(.*?)­\nEmail:\s(.*?)\n(.*?)-{11}\n(.*?)'%- %RegExpBlindMatch='%Text'%- %Subject="%SubPatt='1'"%- %To=""%To=_"%SubPatt='2'" <%SubPatt='3'>_%- Hello %SubPatt='2',

You're subscribed to our mailing list '%SubPatt="1"' with these data: Name: %SubPatt='2' Email: %SubPatt='3' %SubPatt='4'

Still could not make it work.

This is what I did:
I create a new template and it has only your code:
----
%SetPattRegExp='(?is)Subject:\s(.*?)\nName:\s(.*?)­\nEmail:\s(.*?)\n(.*?)-{11}\n(.*?)'%-
%RegExpBlindMatch='%Text'%-
%Subject="%SubPatt='1'"%-
%To=""%To=_"%SubPatt='2'" <%SubPatt='3'>_%-
Hello %SubPatt='2',

You're subscribed to our mailing list '%SubPatt="1"' with these data:
Name: %SubPatt='2'
Email: %SubPatt='3'
%SubPatt='4'
----


It is check to New Messages and Reply messages

Then I send e-mail to my account,
received it and reply it using your template.
This is the e-mail received:
----
FullName: RitLabs
Email: rit@labs.com

Request: Test Message with reply with no dashes
-----------
ip: xxx.23.130.xxx
httpref: http://www.mysite.com/contact.html
httpagent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
----
After hiting the reply,this is the e-mail prepared:
----
the TO field has only:   ""<>
then body has:
Hello ,

You're subscribed to our mailing list '' with these data:
Name:
Email:
----

What I'm missing here?
I try many different combinations on your code just in case it could be wrong(typos), but nothing make it works. In fact, I've been playing with this for about a month now... :(

Thank you for your help and sorry to keep bringing this up. I must be doing something wrong on the way you create the script.



----
 
I've been testing it myself too. And the macro won't work, though I can't figure out why that is.
It's functioning ok when I exclude the 11 dashes from my search.
This is doing what it should:

%SetPattRegExp='(?is)Subject:\s(.*?)\nName:\s(.*?)\nEmail:\s(.*?)\n(.*)'%-
%RegExpBlindMatch='%Text'%-
Hello %SubPatt='2',

You're subscribed to our mailing list '%SubPatt="1"' with these data:
Name: %SubPatt="2"
Email: %SubPatt="3"
%Subject="%SubPatt='1'"%-
%To=""%To=_"%SubPatt='2'" <%SubPatt='3'>_%-

Note that the form you posted in your latest reply is different from the one you showed in the message of 16 September and my regexp triggered on that.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
Pages: 1