|
-
August 24th, 2001, 03:56 AM
#1
Sending Email
How do you send an email programmatically via VB. Picking up a specific file on your HD. Sending this mail with file, without touching your pc. I can not find the code, don't no where to start.
-
August 24th, 2001, 07:06 AM
#2
Re: Sending Email
'make sure that on the default e-mail use of MAPI server is allowed
Option Explicit
'2 controls Microsoft MAPI Control 6.0 -> MAPISession and MAPIMessages
Private Sub Command1_Click()
Dim msg As String
Screen.MousePointer = vbHourglass
msg = "This is a test email"
With Me
'after SignOn the form will appear to ask password. In order to eliminate this form
.MAPILogOn.SignOn ' use current user
Do While .MAPILogOn.SessionID = 0
DoEvents ' need to wait until the new session is created
Loop
Call SendToEmail("[email protected]", msg)
.MAPILogOn.SignOff
End With
Screen.MousePointer = vbNormal
End Sub
Private Sub SendToEmail(ByVal Email As String, ByVal msg As String)
With MAPIMessages1
'create a new message and address it
.SessionID = MAPILogOn.SessionID
.Compose
.RecipDisplayName = Email
.AddressResolveUI = True
.RecipAddress = "smtp:" & Email
.MsgSubject = "VB GENERATED E-MAIL"
'attachment
.AttachmentPathName = "c:\a\a.htm"
.MsgNoteText = msg
.Send False
End With
End Sub
Iouri Boutchkine
[email protected]
-
August 24th, 2001, 07:13 AM
#3
Re: Sending Email
else if U not have a MAPI sessione can try with JMAIL... usually yused for ASP...
A sample code that U can find at http://devcenter.net-impact.net/jmail.asp.
U can find free dowloadable component and distribuition licence information at http://tech.dimac.net/
hi brt
-
August 24th, 2001, 08:49 AM
#4
Re: Sending Email
Try perusing Http://WWW.Planet-Source-Code.com//vb If you can't find a suitable example there it probably can't be done.
John G
-
August 24th, 2001, 08:59 AM
#5
Re: Sending Email
there isn't a method to send mail without using external component or MAPI. To send mail U must use socket and chat with SMTP sever. the proplem is to send attach: U must encode them in MIME.
hi, brt
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
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
|