borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (how to change an ado connection's recordsource(made by adodc) at run time?)Next Topic (Can\'t find a topic that , however . seems to exist) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Email from VB
Poster Message
Creatica
Level: Protégé

Registered: 01-02-2007
Posts: 4

icon Email from VB

I am trying to send an email with VB but am getting stuck on the dim.  It stops at the first line:

dim olapp as Outlook.Application

and returns the message: User-defined type not defined

Is there a component or reference I need to add to my program in order for this to work?  I have a different way of getting the email ready, by using:

'ShellExecute ByVal 0&, vbNullString, str, vbNullString, "C:\", SW_SHOWNORMAL

with my parameters but I can not figure out if there is a way for it to automatically send.  So I'm looking through previous posts and I came across the example:

olmsg.Recipients.Add "Recipients"
olmsg.Attachments.Add "c:\test.txt"
olmsg.Subject = "Subject"
olmsg.Body = "Body"
olmsg.send

I see it should be easy to send a "send" command but I'm getting hung up.  Any ideas?  Thanks!

28-02-2007 at 05:47 PM
View Profile Send Email to User Show All Posts | Quote Reply
humberto
Level: VB Lord

Registered: 13-01-2005
Posts: 246
icon Re: Email from VB

May this help

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 Command1_Click()
ShellExecute hWnd, "open", "mailto:" & "Testtmail.@test.com", vbNullString, vbNullString, SW_SHOW
End Sub

01-03-2007 at 07:56 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Email from VB
Previous Topic (how to change an ado connection's recordsource(made by adodc) at run time?)Next Topic (Can\'t find a topic that , however . seems to exist) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder