J
Jeremy Melvin
I am wanting to take an incoming email from 'someone' and then resend it
automatically. I am using a Outlook Rule to start the VBA program when the
email comes in, and using the VBA program to copy the body and resend to a
mobile number.
I keep reading conflicting statements from my searches on the web and these
fourms about being able to send without getting the Security prompt from OMG.
Could some one please let me know if it is possible for me to do this using
the native VBA in Outlook by changing my code without using a third-party or
sendkeys program?
Here is my code:
Sub ForwardAsSMSTo12345(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msgIn As Outlook.MailItem
Dim msgOut As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msgIn = olNS.GetItemFromID(strID)
Set msgOut = CreateItem(olMailItem)
msgOut.BodyFormat = olFormatPlain
msgOut.Subject = "From ML1500"
msgOut.Body = msgIn.Body
msgOut.To = "(e-mail address removed)"
msgOut.Send
Set msgIn = Nothing
Set msgOut = Nothing
Set olNS = Nothing
End Sub
automatically. I am using a Outlook Rule to start the VBA program when the
email comes in, and using the VBA program to copy the body and resend to a
mobile number.
I keep reading conflicting statements from my searches on the web and these
fourms about being able to send without getting the Security prompt from OMG.
Could some one please let me know if it is possible for me to do this using
the native VBA in Outlook by changing my code without using a third-party or
sendkeys program?
Here is my code:
Sub ForwardAsSMSTo12345(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msgIn As Outlook.MailItem
Dim msgOut As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msgIn = olNS.GetItemFromID(strID)
Set msgOut = CreateItem(olMailItem)
msgOut.BodyFormat = olFormatPlain
msgOut.Subject = "From ML1500"
msgOut.Body = msgIn.Body
msgOut.To = "(e-mail address removed)"
msgOut.Send
Set msgIn = Nothing
Set msgOut = Nothing
Set olNS = Nothing
End Sub