×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CDO and Office 365

CDO and Office 365

CDO and Office 365

(OP)
I have a legacy VB6 app. All was fine as we had our own Exchange server but we have since gone to Office 365.

CODE

Sub SendEMail(strSubject As String, strRecipient As String, strCC As String, strBCC As String, strSender As String, strBodyText As String, strAttachment As String)

    Dim iMsg As Object
    Dim iConf As Object
    Dim Flds As Variant
    Dim i As Integer
    
    'On Error Resume Next
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")

    iConf.Load -1
    Set Flds = iConf.Fields
    
     With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "XXXXX"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "XXXXX"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
        .Update
    End With

    Dim iBP
    With iMsg
        Set .Configuration = iConf
        .To = strRecipient
        .From = strSender
        .CC = strCC
        .BCC = strBCC
        .Subject = strSubject
        .HTMLBody = strBodyText
        If strAttachment <> "" And FlagMarker <> "Daily" Then Set iBP = iMsg.AddAttachment(strAttachment)
        .Send
    End With

    Set iBP = Nothing
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing

End Sub 

Any ideas? Thanks.

Swi

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close