Solved

using CDO to send email

Posted on 2004-09-07
8
436 Views
Last Modified: 2013-12-25
I have working with VB6.0 and want to use CDo to send Email.
for this I have created a Class and this class has one function sendmessage please see below for the function
 

this is the class
************
option explicit
private CDOmsg as cdo.message

Public Function sendMessage(ByVal sAddress As String, _
                            ByVal sSubject As String, _
                            ByVal sMessage As String, _
                            Optional ByVal sAttachment As String) As Boolean
On Error GoTo functionError
    Dim txt As String
    Set CDOmsg = New CDO.Message
    CDOmsg.To = sAddress
    CDOmsg.From = "ABC@Some.com"
    CDOmsg.Subject = sSubject
    CDOmsg.TextBody = sMessage
    If sAttachment <> "" Then
        CDOmsg.AddAttachment sAttachment
    End If
    CDOmsg.Send                    ' here i get an error "The "SendUsing" configuration value is invalid." and it exits the function
 
   sendMessage = True

end function

Private Sub Class_Initialize()
    Set CDOmsg = New CDO.Message
End Sub
***********************************

i created an instance of this class from another module
 Dim obj As AboveClass
  Set obj = New AboveClass

and i call the funciton from the above class

obj.sendmessage "some@hotmail.com","Some subject"," here is the message"

' call runs fine till it reaches the CDOmsg.send statement in the function and then gives me error "The "SendUsing" configuration value is invalid."
0
Comment
Question by:JuniorDeveloper2000
  • 3
  • 2
8 Comments
 

Author Comment

by:JuniorDeveloper2000
ID: 12001438
Guys its kinda urgent
Thanks in advance
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 12001908
0
 

Author Comment

by:JuniorDeveloper2000
ID: 12007066
my work enviournment needs me to use CDO
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:JuniorDeveloper2000
ID: 12039918
I created a Class to send the emails. I used mapi.session, now it works fine using the new class i created. Thanks for all your help.
hey guys Can any one tell me how to close the questions i have posted. once i have accepted the answer or i have figured out a way to do it myself.

Thanks
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 12039994
I you want to have a question deleted or sent to PAQ, you need to post a 0-point in the Community Support: http://www.experts-exchange.com/Community_Support/
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12988999
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now