Click here to Skip to main content
15,895,011 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to sent Mail in VB6.0 Pin
Eddy Vluggen26-Apr-10 0:20
professionalEddy Vluggen26-Apr-10 0:20 
GeneralRe: How to sent Mail in VB6.0 Pin
Tom Deketelaere26-Apr-10 0:32
professionalTom Deketelaere26-Apr-10 0:32 
GeneralRe: How to sent Mail in VB6.0 Pin
Eddy Vluggen26-Apr-10 0:58
professionalEddy Vluggen26-Apr-10 0:58 
GeneralRe: How to sent Mail in VB6.0 Pin
Steven J Jowett25-Apr-10 23:56
Steven J Jowett25-Apr-10 23:56 
GeneralRe: How to sent Mail in VB6.0 Pin
Dalek Dave26-Apr-10 0:09
professionalDalek Dave26-Apr-10 0:09 
AnswerRe: How to sent Mail in VB6.0 Pin
DaveAuld25-Apr-10 23:18
professionalDaveAuld25-Apr-10 23:18 
AnswerRe: How to sent Mail in VB6.0 Pin
Simon_Whale25-Apr-10 23:27
Simon_Whale25-Apr-10 23:27 
AnswerRe: How to sent Mail in VB6.0 Pin
ksenthilbabu26-Apr-10 0:17
ksenthilbabu26-Apr-10 0:17 
Hey Kannan,

Use this class, which i use for the same from VB

Option Explicit
Const cdoSendUsingPickup = 1    'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2    'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0    'Do not authenticate
Const cdoBasic = 1    'basic (clear-text) authentication
Const cdoNTLM = 2    'NTLM
'Delivery Status Notifications
'    In order to use the Delivery Status Notifications (Return
'    Receipt and Delivery Disposition requests)
Const cdoDSNDefault = 0    'None
Const cdoDSNNever = 1    'None
Const cdoDSNFailure = 2    'Failure
Const cdoDSNSuccess = 4    'Success
Const cdoDSNDelay = 8    'Delay
Const cdoDSNSuccessFailOrDelay = 14    'Success, failure or delay

Private mvarCONNECTION_TIMEOUT As Integer    'local copy
'local variable(s) to hold property value(s)
Private mvarMail_Password As String    'local copy
Private mvarMail_UserName As String    'local copy
'local variable(s) to hold property value(s)
Private mvarSMTP_ServerName As String    'local copy
Private mvarSMTP_ServerPort As Integer    'local copy
'local variable(s) to hold property value(s)
Private mvarMail_Attachments As Variant    'local copy
'local variable(s) to hold property value(s)
Private mvarMail_FromName As String    'local copy
'local variable(s) to hold property value(s)
Private mvarMail_To As String    'local copy
Private mvarMail_Cc As String    'local copy
Private mvarMail_Bcc As String    'local copy
'local variable(s) to hold property value(s)
Private mvarMail_Subject As String    'local copy
Private mvarMail_Message As String    'local copy
Public Property Let Mail_Message(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_Message = 5
10        mvarMail_Message = vData
End Property


Public Property Get Mail_Message() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_Message
10        Mail_Message = mvarMail_Message
End Property



Public Property Let Mail_Subject(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_Subject = 5
10        mvarMail_Subject = vData
End Property


Public Property Get Mail_Subject() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_Subject
10        Mail_Subject = mvarMail_Subject
End Property



Public Property Let Mail_Bcc(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_Bcc = 5
10        mvarMail_Bcc = vData
End Property


Public Property Get Mail_Bcc() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_Bcc
10        Mail_Bcc = mvarMail_Bcc
End Property



Public Property Let Mail_Cc(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_Cc = 5
10        mvarMail_Cc = vData
End Property


Public Property Get Mail_Cc() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_Cc
10        Mail_Cc = mvarMail_Cc
End Property



Public Property Let Mail_To(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_To = 5
10        mvarMail_To = vData
End Property


Public Property Get Mail_To() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_To
10        Mail_To = mvarMail_To
End Property



Public Property Let Mail_FromName(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_FromName = 5
10        mvarMail_FromName = vData
End Property


Public Property Get Mail_FromName() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_FromName
10        Mail_FromName = mvarMail_FromName
End Property



Public Property Let Mail_Attachments(ByVal vData As Variant)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_Attachments = 5
10        mvarMail_Attachments = vData
End Property


Public Property Set Mail_Attachments(ByVal vData As Variant)
      'used when assigning an Object to the property, on the left side of a Set statement.
      'Syntax: Set x.Mail_Attachments = Form1
10        Set mvarMail_Attachments = vData
End Property


Public Property Get Mail_Attachments() As Variant
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_Attachments
10        If IsObject(mvarMail_Attachments) Then
20            Set Mail_Attachments = mvarMail_Attachments
30        Else
40            Mail_Attachments = mvarMail_Attachments
50        End If
End Property



Public Property Let SMTP_ServerPort(ByVal vData As Integer)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.SMTP_ServerPort = 5
10        mvarSMTP_ServerPort = vData
End Property


Public Property Get SMTP_ServerPort() As Integer
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.SMTP_ServerPort
10        SMTP_ServerPort = mvarSMTP_ServerPort
End Property



Public Property Let SMTP_ServerName(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.SMTP_ServerName = 5
10        mvarSMTP_ServerName = vData
End Property


Public Property Get SMTP_ServerName() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.SMTP_ServerName
10        SMTP_ServerName = mvarSMTP_ServerName
End Property



Public Property Let Mail_UserName(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_UserName = 5
10        mvarMail_UserName = vData
End Property


Public Property Get Mail_UserName() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_UserName
10        Mail_UserName = mvarMail_UserName
End Property



Public Property Let Mail_Password(ByVal vData As String)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.Mail_Password = 5
10        mvarMail_Password = vData
End Property


Public Property Get Mail_Password() As String
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.Mail_Password
10        Mail_Password = mvarMail_Password
End Property



Public Property Let CONNECTION_TIMEOUT(ByVal vData As Integer)
      'used when assigning a value to the property, on the left side of an assignment.
      'Syntax: X.CONNECTION_TIMEOUT = 5
10        mvarCONNECTION_TIMEOUT = vData
End Property


Public Property Get CONNECTION_TIMEOUT() As Integer
      'used when retrieving value of a property, on the right side of an assignment.
      'Syntax: Debug.Print X.CONNECTION_TIMEOUT
10        CONNECTION_TIMEOUT = mvarCONNECTION_TIMEOUT
End Property




Public Sub MailMessage()
          Dim iMsg As CDO.Message
          Dim iConf
          Dim Flds As Variant

          'Set iMsg = CreateObject("CDO.Message")
10        Set iMsg = New CDO.Message
20        Set iConf = CreateObject("CDO.Configuration")
30        Set iConf = New CDO.Configuration
          '    iConf.Load -1     ' CDO Source Defaults
40        iConf.Load cdoDefaults, ""
          '    Set Flds = iConf.Fields
50        With iConf.Fields
60            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
70            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mvarSMTP_ServerName
80            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = mvarSMTP_ServerPort
90            .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
100           .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
110           .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = Trim(mvarMail_UserName)
120           .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Trim(mvarMail_Password)
130           .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = mvarCONNECTION_TIMEOUT
140           .Update

150       End With


160       With iMsg
170           Set .Configuration = iConf
180           .From = Trim(mvarMail_FromName) & "<" & Trim(mvarMail_UserName) & ">"
190           .Sender = Trim(mvarMail_UserName)
200           .To = Trim(mvarMail_To)
210           .CC = Trim(mvarMail_Cc)
220           .BCC = Trim(mvarMail_Bcc)
              ' Note: The reply address is not working if you use this Gmail example
              ' It will use your Gmail address automatic. But you can add this line
              ' to change the reply address .ReplyTo = "Reply@something.Com"
230           .Subject = Trim(mvarMail_Subject)
240           .TextBody = Trim(mvarMail_Message)
250           .AddAttachment mvarMail_Attachments
260           .Fields("urn:schemas:httpmail:importance") = 2
270           .Fields("urn:schemas:mailheader:X-Priority") = 1
280           .Fields("urn:schemas:mailheader:disposition-notification-to") = Trim(mvarMail_UserName)
290           .Fields("urn:schemas:mailheader:return-receipt-to") = Trim(mvarMail_UserName)
              '.DSNOptions = cdoDSNSuccessFailOrDelay
              '        '        .MDNRequested = True
300           .Fields.Update
310           .send
320       End With
330       Set iMsg = Nothing
340       Set iConf = Nothing
End Sub


Have a Happy Day.
GeneralRe: How to sent Mail in VB6.0 Pin
Dalek Dave26-Apr-10 0:20
professionalDalek Dave26-Apr-10 0:20 
GeneralRe: How to sent Mail in VB6.0 Pin
εїзεїзεїз26-Apr-10 21:24
εїзεїзεїз26-Apr-10 21:24 
Questionparallel ports Pin
Jack W. Pulling25-Apr-10 11:05
Jack W. Pulling25-Apr-10 11:05 
AnswerRe: parallel ports Pin
DaveAuld25-Apr-10 11:15
professionalDaveAuld25-Apr-10 11:15 
AnswerRe: parallel ports PinPopular
DaveAuld25-Apr-10 20:50
professionalDaveAuld25-Apr-10 20:50 
AnswerRe: parallel ports Pin
Abhinav S25-Apr-10 20:58
Abhinav S25-Apr-10 20:58 
AnswerRe: parallel ports Pin
NormDroid25-Apr-10 21:02
professionalNormDroid25-Apr-10 21:02 
AnswerRe: parallel ports PinPopular
Dalek Dave25-Apr-10 22:08
professionalDalek Dave25-Apr-10 22:08 
GeneralRe: parallel ports Pin
Simon_Whale25-Apr-10 23:15
Simon_Whale25-Apr-10 23:15 
GeneralRe: parallel ports Pin
Luc Pattyn26-Apr-10 1:14
sitebuilderLuc Pattyn26-Apr-10 1:14 
GeneralRe: parallel ports Pin
Pete O'Hanlon26-Apr-10 1:20
mvePete O'Hanlon26-Apr-10 1:20 
GeneralRe: parallel ports Pin
Dalek Dave26-Apr-10 1:24
professionalDalek Dave26-Apr-10 1:24 
GeneralRe: parallel ports Pin
Pete O'Hanlon26-Apr-10 1:28
mvePete O'Hanlon26-Apr-10 1:28 
GeneralRe: parallel ports Pin
Dalek Dave26-Apr-10 1:29
professionalDalek Dave26-Apr-10 1:29 
QuestionFetch Autonumber from Firebird ? Pin
ksenthilbabu24-Apr-10 4:38
ksenthilbabu24-Apr-10 4:38 
AnswerRe: Fetch Autonumber from Firebird ? Pin
Md. Marufuzzaman24-Apr-10 20:44
professionalMd. Marufuzzaman24-Apr-10 20:44 
GeneralRe: Fetch Autonumber from Firebird ? Pin
Henry Minute25-Apr-10 12:23
Henry Minute25-Apr-10 12:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.