Re: Email Forwarding

Status
Not open for further replies.
V

VG9tYXM

Hello Ken,

may be you could help me with similar Issue i think i can not handle easily.

I am not sure which way to go on incoming email and specific text in subject.

i see i have two options. On incoming email with text in Subject either run

script or make auto reply directly in outlook. What i am looking for is to

take a piece subject of email i got and repost it.

The incoming email subject looks like "Service call 10745707 has been

assigned to you."

What i would like to do is to reply to this emial like:

_send to: email@email.com

_subject: update 10745707

_Body: status=In Progress

I also though i could run a script on this like start application excel,

data to columns and then the code for send email. Anyway this looks to me

kinda to complicated and also when running this script my pc must be always

on.

Could you please help me with this issue?

Thank you in advance

Best regards

Tomas
wrote:


> Something like this, although this has no real error handling and needs to
> be tweaked so there's no possibility of an endless loop. This code would go
> into the ThisOutlookSession class module in the Outlook VBA project.

> You would of course have to sign the project or lower macro security to have
> it run.

> Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
> Dim aID() As String
> Dim oMail As Outlook.MailItem
> Dim oFwd As Outlook.MailItem
> Dim oNS As Outlook.NameSpace
> Dim oRecip As Outlook.Recipient
> Dim obj As Object
> Dim i As Long
> Dim sBody As String

> Const SEARCH_FOR As String = "Foobar"
> Const SEARCH_ADDY As String = "joe@foobar.com"
> Const FORWARD_TO As String = "moe@foobar.com"

> Set oNS = Application.GetNamespace("MAPI")

> On Error Resume Next

> aID = Split(EntryIDCollection, ",")
> For i = LBound(aID) To UBound(aID)
> Set obj = oNS.GetItemFromID(aID(i))
> If obj.Class = olMail Then
> Set oMail = obj
> sBody = oMail.Body
> If ((InStr(1, sBody, SEARCH_FOR, vbTextCompare) > 0) And _
> (oMail.SenderEmailAddress = SEARCH_ADDY)) Then

> Set oFwd = oMail.Forward
> Set oRecip = oFwd.Recipients.Add(FORWARD_TO)
> oRecip.Resolve
> If oRecip.Resolved Then
> oFwd.Send
> End If

> End If
> End If

> Set oMail = Nothing
> Set oFwd = Nothing
> Set oRecip = Nothing
> Set obj = Nothing
> Next

> Set oNS = Nothing
> End Sub

> >

>

> "TerryM" <TerryM> wrote in message
> news:48A46B4E-81E4-4034-8A6A-6D94DF9A3504@microsoft.com...
> > That's more of what I was looking for, but like I stated before. I'm
> > relatively new to VBA programming especially in Outlook. Were more of a
> > Delphi place, what would the code that I'm requiring look like?


>
 
K

Ken Slovak - [MVP - Outlook]

Please do not hijack other people's threads. What you are asking has nothing

to do with this thread.

If you want code to run obviously your computer must be running.

You can use an ItemAdd() handler or a NewMailEx() handler in the Outlook VBA

project and get the properties you want from the incoming item and use

Application.CreateItem(olMail) to create a new email. You can then populate

that item, say it's oMail as desired: oMail.Subject = "whatever",

oMail.Recipients.Add("email@email.com"), oMail.Body = "status=In Progress",

etc. You can then call Send() on the item to send it out.

"Tomas" <Tomas> wrote in message

news:C7C3F1E2-CF20-4433-9E52-F208C52D1404@microsoft.com...
> Hello Ken,
> may be you could help me with similar Issue i think i can not handle
> easily.
> I am not sure which way to go on incoming email and specific text in
> subject.

> i see i have two options. On incoming email with text in Subject either
> run
> script or make auto reply directly in outlook. What i am looking for is to
> take a piece subject of email i got and repost it.

> The incoming email subject looks like "Service call 10745707 has been
> assigned to you."

> What i would like to do is to reply to this emial like:
> _send to: email@email.com
> _subject: update 10745707
> _Body: status=In Progress

> I also though i could run a script on this like start application excel,
> data to columns and then the code for send email. Anyway this looks to me
> kinda to complicated and also when running this script my pc must be
> always
> on.

> Could you please help me with this issue?
> Thank you in advance
> Best regards
> Tomas
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
T Original email text not shown when replying or forwarding the email. Using Outlook 6
D Keep Original html body when forwarding an email Outlook VBA and Custom Forms 7
I Forwarding attachments in email received Outlook VBA and Custom Forms 3
A Forwarding email and replacing body Outlook VBA and Custom Forms 1
D VBA to edit body of incoming email and forwarding it Outlook VBA and Custom Forms 11
G VBA/Macro to remove page colour when replying or forwarding email Outlook VBA and Custom Forms 2
N Auto-forwarding an Email received from a specific Email address After slight modifications Using Outlook 4
D Forwarding Exchange Email without meeting updates Using Outlook 1
P Forwarding Email With Encrypted Attachment Exchange Server Administration 1
N Save Selected Email Message as .msg File Outlook VBA and Custom Forms 9
HarvMan Toggle between calendar and email in Outlook 365 Using Outlook 2
F Email being marked as Spam by Gmail and not being visible in Outlook Using Outlook 3
G Email time stamp Using Outlook 2
G Schedule recurring email and attachments display Outlook VBA and Custom Forms 3
G Save and Rename Outlook Email Attachments Outlook VBA and Custom Forms 0
B Need to Copy an email to a subfolder Outlook VBA and Custom Forms 2
M How to setup outlook after importing old account information - Entering email account info creates with "(1)" after the account! Using Outlook 1
K Multiple Rules on Single Email Using Outlook 2
F VBA to move email from Non Default folder to Sub folders as per details given in excel file Outlook VBA and Custom Forms 8
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
O Same email address, same person, names in so many ways Using Outlook 4
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
D Outlook launch email showing new unread email in reading pane Using Outlook 11
B Zoom automatically next email item (VBA) Outlook VBA and Custom Forms 2
K Outlook adds space to rows in HTML email signatures viewed on mobile Using Outlook 1
M HTML email signature in Outlook Using Outlook 1
M Respond to Outlook Email Outlook VBA and Custom Forms 0
U Outlook locking up when replying to Email Using Outlook 7
S Email Generated from another program and then edited sends original email. Using Outlook 2
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
S Unable to extract text from an Outlook email message Using Outlook 2
H Search Email Header for Content Type Outlook VBA and Custom Forms 1
A VBA Script - Print Date between first email in Category X and last email in Category Y Outlook VBA and Custom Forms 3
R Problem moving file “Email folders.pst” to new PC Using Outlook 5
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
P How did hacker cause link to delete and archive containing email? Using Outlook 6
I 'quote marks' around email name Using Outlook 1
N contact list seen in Contact folder but knot in Address book or when 'TO' button is clicked in new email Using Outlook 0
T Junk Email does not get added to the Blocked Sender List Using Outlook 0
P i-Phone 6s Plus receiving 2 notifications from Outlook email Using Outlook 1
C WARNING - DO NOT USE AN OUTLOOK.COM ADDRESS FOR GOOGLE ACCOUNT RECOVERY EMAIL Using Outlook 10
T Why is every new email pinned (to keep it on top)? Windows 10 Using Outlook 6
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
P Can I create a Rule that sends me an email when I get a Task? Using Outlook 3
M Issue transferring Outlook 2016 email accounts & settings onto new computer Using Outlook 8
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
S Outlook email to configure setup for each mail Outlook VBA and Custom Forms 1
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 2
A Is there an ID field you can use to pair a reply to the sent email? Outlook VBA and Custom Forms 4

Similar threads

Top