|
-
May 17th, 2000, 01:41 PM
#1
Thread Starter
Registered User
Hey all...
Does any1 know how can I send an Email through VB code?
I mean, I dont wanna use the Shell method for openning the Outlook Express and then I'll have to click on the Send button.
I wanna send Email, lets say to [email protected] ,
without openning the Outlook Express, And I wanna be able
to set all of the Email features, like Subject, Body, Attachment,....
Any Idea?
-
May 17th, 2000, 02:18 PM
#2
Addicted Member
Hi, of course you can do this from VB code, what you must make sure of is, that you need the CDO 1.21 object and for the example I'm giving you the CDONTS Dll, these are automatically installed with win2000, or if you are working on NT they come with Exchange Server.
code:
Private Sub cmdSend_Click()
On Error GoTo Me_Err_Handle
Dim CDO As CDONTS.NewMail
Set CDO = CreateObject("CDONTS.NewMail")
CDO.From = txtFrom
CDO.To = txtTo
If Len(Trim(txtCc)) > 0 Then CDO.Cc = txtCc
If Len(Trim(txtBcc)) > 0 Then CDO.Bcc = txtBcc
If Len(Trim(txtSubject)) > 0 Then CDO.Subject = txtSubject
CDO.Body = txtBody
CDO.BodyFormat = 0
CDO.AttachFile txtAttachment
CDO.Send
Exit Sub
Me_Err_Handle:
MsgBox Err.Number & " - " & Err.Description, vbCritical, "Error..."
End Sub
Make a form with some text boxes and a send button. You can name the text boxes as the example.
Good luck,
André
-
May 17th, 2000, 03:25 PM
#3
Hyperactive Member
If I am using Win98 and VB5/VB6, can I use the CDO1.21, if so, where can I download / purchase this?
-
May 17th, 2000, 04:17 PM
#4
Addicted Member
Hi, here is some software info:
To enable client applications to use CDO 1.2.1, install Microsoft Outlook 98. For server applications, install Microsoft Exchange Server version 5.5.
Note CDO works with Microsoft Outlook, but CDO.DLL is not installed with the Microsoft Outlook 97 setup program.
If you want to learn more try this link:
http://msdn.microsoft.com/library/de...aover_34a7.htm
PS. The code I presented earlier works for CDONTS, coding for CDO 1.21 is slightly different, but you'll find all you need in that link,
good luck,
André
-
May 17th, 2000, 04:22 PM
#5
Hyperactive Member
How about for users's machine, do they have to install outlook?
-
May 17th, 2000, 04:29 PM
#6
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|