This area of the website is no longer being updated.
Changes and news are now published on this page.

How to capture an email address in the email body and send an autoresponse

October 27, 2017

Recently a user has asked if it is possible to capture (parse) an email address written in the email body, not in the From, To, CC etc. and sending an automatic reply to that address. The answer is that parsing email addresses is very easy as they have a very well defined format:

name@domain.com

Some of them even have an indefinite number of subdomains:

name@subsubdomain.subdomain.domain.topleveldomain

Searching in our recommended site for a regular expression that matches an email address we have found this one:

\w+@\w+(\.\w+)+

Which, in plain English means: a string of letters followed by a @ and another string of letters. It follows another string of letters preceeded by a dot, and this last subset can be repeated many times.

This regular expression will not match some weird email addresses, but 99.9% of them will. For the purpose of showing how to parse email addresses is enough but you can use more powerful ones.

In Email Parser it is set up as follows:

This field, called email_address_in_body, is defined within an email parser item that looks like this:

And the Email Parser the left panel, where all the items and the flow of information is shown, looks as follows:

In order to prevent sending automatic replies when no email addresses are found we have placed a conditional check before sending a reply. This item called “check if we have captured an email address” checks if the field email_address_in_body contains a text. If “my simple email body parser” is not able to find a text string that matches the regular expression email_address_in_body will be left blank.

Clicking Run in Email Parser we get the following output:

········ 10/27/2017 10:51:10 AM Started

········ Checking emails for _____@gmail.com

Downloading email 1 of 1

 

Processing email 1 of 1

 From: “Carlos Andrés” <_____@gmail.com> To: “Carlos” <______@gmail.com> Subject: This is a sample incoming email
Hello, Bla blah blah, carlos@frozenfrog.es etc etc — Carlos Andrés FrozenFrog Software 26, Miguel de Unamuno St. E-09001 Burgos Spain Phone and Fax available upon request. Skype id: cls357
More details

The email contains the following fields:

Subject This is a sample incoming email
From “Carlos” <_____@gmail.com>
To “Carlos” <_____@gmail.com>
Body Hello,Bla blah blah, carlos@frozenfrog.es etc etc  ……
Body_HTML <div dir=”ltr”>Hello,<div><br></div><div>Bla blah blah, <a   ……
DateTimeSent 2017-10-27 10:50:04
DateTimeReceived 2017-10-27 10:51:12
RawHeader MIME-Version: 1.0Received: by 10.79.32.143 with HTTP; Fri  ……
CC empty
BCC empty
 

········ Running parser my simple email body parser

The parser produced the following results:

email_address_in_body carlos@frozenfrog.es
 

········ Running action check if we have captured an email address

Determining if ’email_address_in_body’ contains any value

The condition has been met

 

········ Running action send a reply

Connecting to the SMTP server

Logging in

Sending the email

Email successfully sent

········ Finished  

© 2008-2024 Triple Click Software
News & Updates

Windows App privacy police and terms of use
Web App privacy police and terms of use

This site privacy police and terms of use
PAD file·Old news