• Subject: Re: Want to forward a template email with an email address contained in the trigger email
  • Author: Ken Slovak
  • Date: 01 Nov 2010
  • References: 1
Answered in the OutlookDev forum you also posted in.

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

"Casey Sheldon" <ayrkain@ayrkain.com> wrote in message
news:4a8de7cd-49fb-4d22-9b0b-851ee3a9a3f1@p1g2000yqm.googlegroups.com...
> I'm trying to automate a process wherein an email comes in with a
> certain Subject, then a regex pulls an email address out of that
> trigger email, and sends a template to that email address. What I have
> so far is somewhat mangled. Please help?
>
> Sub CustomMailMessageRule(Item As Outlook.MailItem)
> Dim myolApp As Outlook.Application
> Dim myItem As Outlook.MailItem
> Dim mySend As Outlook.MailItem
> Set myNamespace = myolApp.GetNamespace("MAPI")
> Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
> Set myolApp = CreateObject("Outlook.Application")
> If Not myFolder.Items = 0 Then
> Set myItem = myFolder.Items(1)
> myItem.BodyFormat = olFormatPlain
> Set mySend = myolApp.CreateItemFromTemplate("C:\template.oft")
> With mySend
> .Recipients = RE6(myItem.Body)
> .Subject = "Blahdy blah"
> End With
> ' mySend.Send
> End If
>
> End Sub
>
> Function RE6(strData As String) As String
> Dim RE As Object, REMatches As Object
> Set RE = CreateObject("vbscript.regexp")
> With RE
> .MultiLine = True
> .Global = False
> .IgnoreCase = True
> .Pattern = "(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)"
> & _
> "|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-
> Z]{2,6}"
> End With
>
> Set REMatches = RE.Execute(strData)
> RE6 = REMatches(0)
>
> End Function
>
> Haven't used vb since vb6, and I guess it probably shows. Thanks in
> advance for any help.
29 Oct 2010Want to forward a template email with an email address contained inthe trigge....Casey Sheldon
01 Nov 2010\ Re: Want to forward a template email with an email address contained in the t....Ken Slovak
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)