Sending mail from vb using outlook express
Hai everybody,
i have a piece of coding that is used to send a mail from the vb6 using outlook expresss. The code is shown below.
Private outlk As Outlook.Application
Private Sub cmdSendmail_Click()
Set outlk = New Outlook.Application
Dim addr As New Collection 'address
Dim attach As New Collection 'attachment
Dim subject As String 'subjeect
Dim body As String 'body
Dim blnSendOK As Boolean
subject = "Testing of Subject"
body = "Testing of Body"
addr.Add "k_priyan@yahoo.com"
attach.Add "c:\myfile.emf"
blnSendOK = OutLookMailto(outlk, subject, body, addr, attach)
If blnSendOK Then
MsgBox ("Send OK!!")
Else
MsgBox "not sent"
End If
End Sub
Public Function OutLookMailto(OutLooks As Outlook.Application, _
ByVal strSubject As String, _
ByVal strText As String, colAddrList As Collection, _
colAttachments As Collection) As Boolean
Dim Mail As MailItem
Dim strTemp
Set Mail = OutLooks.CreateItem(olMailItem) 'Mail Item
With Mail
For Each strTemp In colAddrList
.Recipients.Add strTemp
Next
For Each strTemp In colAttachments
.Attachments.Add strTemp
Next
.subject = strSubject
.body = strText
.Save
.Send
End With
Set Mail = Nothing
OutLookMailto = True
Exit Function
Errh:
OutLookMailto = False
End Function
i am getting the output send ok!! message box. but i have not received any mail yet.
Can anyone sort out this problem, it will be more helpful to me.
Thanks.
yours,
Gopal
what references should i add to my project
To work with CDONTS to send mail from vb what references should i add to my project. should i install anything for that. please specify the required details.
Thanks.
yours,
Gopal
I must use outlook express
hai Sastraxi and everybody,
I am in the need to use the outlook express compulsarily.
As i mentioned in the first post with the coding, the mail has been sent but i am not able to receive it. And also, when running , an application named "Outlook Express" appears and immediately disappears.
But i should have the Outlook express explicitly open.
So please provide me the way to do this. it is very urgent.
Thanks.
Yours,
Gopal