[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to send a Email Using SMTP Sevre Authentication

Posted on 2008-01-31
4
Medium Priority
?
382 Views
Last Modified: 2013-12-17
I would like to send a email message using CDOSYS, which is used when the computer does not have a direct connection to the local server. The code below will not work because I keep getting a error message stating. "Property Items is read only" It located on this section of Code. I have attached the complete Code in the Code section

Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.charter.net"
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmail@MyDomain.com"
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPa$$word"
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

Dim MyMessage As New CDO.Message()
        Dim Config As New CDO.Configuration()
 
        ' This part is required if your mail server requires authentication
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.charter.net"
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmail@MyDomain.com"
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPa$$word"
        Config.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
 
        Config.Fields.Update()
        MyMessage.Configuration = Config
 
        'Create The message.
 
        MyMessage.To = ""
        MyMessage.From = ""
 
        MyMessage.Subject = "A New Email Message"
        MyMessage.TextBody = "I hope you get this email! Ill talk to you later!"
 
 
        Try
 
            'Send The CDOSYS
            MyMessage.Send()
 
        Catch Ex As Exception
 
        End Try

Open in new window

CDOSystem.txt
0
Comment
Question by:daruffin
  • 2
  • 2
4 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 20794529
Try this:
Dim MyMessage As New CDO.Message()
 
        ' This part is required if your mail server requires authentication
        MyMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        MyMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.charter.net"
        MyMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmail@MyDomain.com"
        MyMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPa$$word"
        MyMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
 
        MyMessage.Configuration.Fields.Update()
 
 
        'Create The message.
 
        MyMessage.To = ""
        MyMessage.From = ""
 
        MyMessage.Subject = "A New Email Message"
        MyMessage.TextBody = "I hope you get this email! I.ll talk to you later!"
 
 
        Try
 
            'Send The CDOSYS
            MyMessage.Send()
 
        Catch Ex As Exception
 
        End Try

Open in new window

0
 

Author Comment

by:daruffin
ID: 20796915
I'm still getting a blue line under the code stating Property 'Item is readonly
0
 
LVL 82

Accepted Solution

by:
hielo earned 375 total points
ID: 20797756
How about this:
Dim MyMessage As CDO.Message
MyMessage = New CDO.Message()
 
        ' This part is required if your mail server requires authentication
        MyMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        MyMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.charter.net"
        MyMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmail@MyDomain.com"
        MyMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPa$$word"
        MyMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
 
        MyMessage.Configuration.Fields.Update()
 
 
        'Create The message.
 
        MyMessage.To = ""
        MyMessage.From = ""
 
        MyMessage.Subject = "A New Email Message"
        MyMessage.TextBody = "I hope you get this email! I.ll talk to you later!"
 
 
        Try
 
            'Send The CDOSYS
            MyMessage.Send()
 
        Catch Ex As Exception
 
        End Try
Set MyMessage = Nothing

Open in new window

0
 

Author Closing Comment

by:daruffin
ID: 31426903
This worked just fine now. Thanks so much for your help
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
Suggested Courses

611 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question