-
Nov 24th, 2002, 11:38 PM
#1
Thread Starter
New Member
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
-
Nov 24th, 2002, 11:52 PM
#2
Good Ol' Platypus
I much prefer the CDONTS.NewMail object. Try looking it up!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
(Just a heads-up)
-
Nov 25th, 2002, 12:59 AM
#3
Thread Starter
New Member
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
-
Nov 25th, 2002, 06:39 AM
#4
Thread Starter
New Member
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
-
Nov 25th, 2002, 06:45 AM
#5
Addicted Member
Buddy, i guess the code u have posted is for MS Outlook, not Outlook Express!
I was gratified to be able to answer promptly. I said I don't know!
-
Nov 25th, 2002, 07:36 AM
#6
Thread Starter
New Member
both are same
Hai ms-outlook and outlook express are same .
-
Nov 26th, 2002, 01:11 AM
#7
Addicted Member
They are not the same. The given code is automation of MS Outlook. I had worked on a similar project. the same code without any modification doesn't work for Outlook Express.
I was gratified to be able to answer promptly. I said I don't know!
-
Nov 27th, 2002, 04:53 AM
#8
Thread Starter
New Member
Yes it is correct
hai Binish,
U r right. i found the difference between the two. Thanks.
But, i am not in the position to open only the window of the outlook express to send mail.But the code that i have given above send the mail automatically.
So provide me the way in which i could see the page used to send mail of the Outlook express.
I hope u might understand the problem.
Expecting solution evry soon.
Thanks,
Gopal
-
Nov 28th, 2002, 06:30 AM
#9
Thread Starter
New Member
Finally i Found out
Hai everybody,
Thanks to everyone. I got the solution.
yours,
Gopal
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
|