Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 20th, 2006, 05:24 PM
cvanderpool cvanderpool is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 1 cvanderpool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 38 sec
Reputation Power: 0
Issues redirecting mail in outlook using VBA. Help greatly appreciated

Below is my script in MS Outlook 2003. I am using XP Pro and exchange server. I am trying to put together a script that will redirect all new email to my handheld device leaving a copy in my inbox. I get a runtime error each time new mail arrives pointing to the (.update) line in my code.

Error - Fields update failed, for further info, examine status property of individual field objects.

Any help or direction would be greatly appreciated!


Sub RedirectNewMail(MyMail As MailItem)
' Jim Boyce and Sue Mosher
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set itm = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
Set myInbox = olNS.GetDefaultFolder(olFolderInbox)
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim szServer
Const cdoSendUsingPort = 25

'Set MessageItems = MessageFolder.Items
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
szServer = "my domain"
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my ip address"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 100
.Update
End With
Set iMsg.Configuration = iConf

' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "my handhelp address" 'ToDo: Enter a valid email address.
.From = "itm.SenderEmailAddress" 'ToDo: Enter a valid email address.
.Subject = "This is a test CDOSYS message (Sent via Port 25)"
.HTMLBody = strHTML
.Send
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

MsgBox "Mail Sent!"

' Build the message
'iMsg.To = "c.vanderpool@tmo.blackberry.net"
'iMsg.From = itm.SenderEmailAddress
' iMsg.Subject = itm.Subject
'iMsg.Send

' Mark as read and move the message to the NL Processed folder
itm.UnRead = False
End Sub

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Issues redirecting mail in outlook using VBA. Help greatly appreciated


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT