Ryan's District
November 22, 2008, 04:28:13 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Ryan's District Lottery: Claim your ticket or check
Jackpot details  
 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Fun with Email Version 2  (Read 3571 times)
0 Members and 1 Guest are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 07, 2006, 03:46:46 PM »

I did have some fun with email in my original article.  I had many responses from individuals who also had some fun. ;>   ;>   One of those individuals had so much fun that he wrote me to explain how much fun he had. Mr. Perry’s (from Murfreesboro, TN USA) email is below, where he has clearly outlined better use of cdosys.dll.

NOTE: I found some software that makes development a lot faster and improves windows in general: Firefox with Google Toolbar

The following text is quoted from Mr. Perry with my comments in ().

I read your article on CDO/MAPI mail with interest (<grin>).  I had just climbed the same slippery slope with a "pro bono" application I'm writing for an emergency service group.  I found the answer in cdosys.dll and cdoex.dll.  If you have the later cdosys.dll (version 6.1.3940.29) from Win 2000 SP3, it will work without Exchange.  It appears to default to MAPI if Exchange is not present.  If the user has Office XP, the VB program will use it instead of cdosys.dll.  I have experimented with distributing cdosys.dll with my application on Win 98SE machines and it works well on them.  Here is my code...

Sure, you can use my code snips.  As you say, the availability of info on CDO leaves much to be desired!  If you have cdosys.dll (from Win 2000 SP3) or cdoex.dll (from Office XP) on your PC, in the VB IDE, go to "Project/References..." Look for "Microsoft CDO For Exchange 2000 Library" and select it.  Click OK and the code will work.  You also need to select "Microsoft ActiveX Data Objects 2.5 Library" as the fields in my code for the priority info are accessed via ADO.

Public Sub CDOEmailSend()
       Dim iMsg As New cdo.Message
       Dim iConf As New cdo.Configuration
       Dim tmp As String
       Dim iBp  As cdo.IBodyPart
       Dim cFld  As ADODB.Fields
       Dim iFld As ADODB.Fields
 
       Set iBp = iMsg
       Set cFld = iConf.Fields
       Set iFld = iBp.Fields
 
       '  Priority structure:
       '       High:   X-Priority=1     Normal:  X-Priority=3  Low:    X-Priority=5
       '       X-MSMail-priority=High  X-MSMail-priority=Normal      X-MSMail-priority=Low
 
       With iFld
           .Item("urn:schemas:mailheader:X-Priority") = Switch(Dfld.sEEIPri=  "Z", "1", _

               Dfld.sEEIPri = "M", "3", Dfld.sEEIPri = "R", "3", Dfld.sEEIPri="P", "1", _

               Dfld.sEEIPri = "O", "1", Dfld.sEEIPri = "T", "5")
           .Item("urn:schemas:mailheader:X-MSMail-priority") =  Switch(Dfld.sEEIPri = "Z", "High",_

               Dfld.sEEIPri = "M", "Normal", Dfld.sEEIPri = "R", "Normal", Dfld.sEEIPri = "P", _

               "High", Dfld.sEEIPri = "O", "High", Dfld.sEEIPri = "T", "Low")
           .Update
       End With
 
       With cFld
           .Item(cdoSendUsingMethod) = cdoSendUsingPort
           .Item(cdoSMTPServer) = Edat.strMailServer
           .Item(cdoSMTPServerPort) = 25
           .Item(cdoSMTPAccountName) = Edat.strMailAccountName
           tmp = """" & Edat.strMailDisplayName & """" & " <" & Edat.strMailAddress & """"
           .Item(cdoSendUserReplyEmailAddress) = tmp
           .Item(cdoSendEmailAddress) = tmp
           .Item(cdoSMTPConnectionTimeout) = 10
           .Item(cdoSMTPAuthenticate) = cdoBasic
           .Item(cdoSendUserName) = Edat.strMailUserName
           .Item(cdoSendPassword) = Edat.strPassword
           .Item(cdoURLProxyServer) = "server:80"
           .Item(cdoURLProxyBypass) = "<local"
           .Item(cdoURLGetLatestVersion) = True
           .Update
       End With
 
       With iMsg
           Set iMsg.Configuration = iConf
               .AutoGenerateTextBody = False
               .To = eM.To
               .CC = eM.CC
               .BCC = eM.BCC
               .From = tmp
               .Subject = eM.Subject
               .TextBody = eM.msg
               On Error GoTo MailError
               Screen.MousePointer = 11
               .Send
               Screen.MousePointer = 0
       End With
       Exit Sub
  MailError:
       Screen.MousePointer = 0
       MsgBox Err.Number & ": " & Err.Description, vbExclamation, "Mail Send Failure"
  End Sub
 

End code

I hope you can get some good info from this code snip,

good luck, and thanks to Mr. Perry,

-Matt Burnett

 
Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
« on: October 07, 2006, 03:46:46 PM »

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: RAYAN.tv
-

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.324 seconds with 30 queries.

Google visited last this page November 15, 2008, 07:58:52 AM