VB 6.0 - how to send email using VB? - Asked By Ralph Acido on 07-Mar-06 08:34 PM

hello! please help on how to send an email using VB.. Thanks in advance...

check this link - Asked By Ramya T on 07-Mar-06 09:00 PM

They have given sample code for sending through SMTP or by referencing OUTLOOK.


send email using VB - Asked By John Conway on 07-Mar-06 09:49 PM

Put a label on your form named label1 and change the  label caption to : Compose Mail --- or what ever you wish. 


Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub label1_Click()
 With label1
 .Drag vbBeginDrag
End With
End Sub

Private Sub label1_DragDrop(Source As Control, X As Single, Y As Single)
    If Source Is label1 Then
        With label1
    Call ShellExecute(0&, vbNullString, "Mailto:" & .Caption, vbNullString, vbNullString, vbNormalFocus)
    End With
    End If
End Sub

Use CDO - Asked By Venkat K on 07-Mar-06 10:37 PM

1. Open a new project in Visual Basic.  
2. On the Tools menu, choose References and select the Microsoft CDO 1.21 Library.  
3. Add a CommandButton object to the default form. Accept the default name, Command1.  
4. Copy the following code into the General Declarations section of the default form.     Option Explicit

     Private Sub Command1_Click()
       Dim objSession As Object
       Dim objMessage As Object
       Dim objRecipient As Object

       'Create the Session Object.
       Set objSession = CreateObject("mapi.session")

       'Logon using the session object.
       'Specify a valid profile name if you want to.
       'Avoid the logon dialog box.
       objSession.Logon profileName:="MS Exchange Settings"

       'Add a new message object to the OutBox.
       Set objMessage = objSession.Outbox.Messages.Add

       'Set the properties of the message object.
       objMessage.subject = "This is a test."
       objMessage.Text = "This is the message text."

       'Add a recipient object to the objMessage.Recipients collection.
       Set objRecipient = objMessage.Recipients.Add

       'Set the properties of the recipient object.
       objRecipient.Name = "John Doe"  '<---Replace this with a valid
                                       'display name or e-mail alias
       'Type can be ActMsgTo, mapiTo, or CdoTo for different CDO versions;
       'they all have a constant value of 1.
       objRecipient.Type = mapiTo

       'Send the message.
       objMessage.Send showDialog:=False
       MsgBox "Message sent successfully!"

       'Logoff using the session object.
     End Sub
5. Run the project. Click Command1. You have sent e-mail from Visual Basic.
see this site - Asked By CHANDU V on 10-Mar-06 02:44 AM

see this site