Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Email from VB app

Status
Not open for further replies.

Sheriff

Programmer
Sep 1, 2001
34
US
Hi, I want to send email from VB,can any one help, is there a site that may have tutorials using the winsock control.
any help would be appreciated.

thanks
Sheriff
 
I found a good FREE ocx that will do that for you and more but I don't see anyway here to attach it to my reply. Give me your email addy and I will send it to you.

 
Just use the 2 MAPI activX control components. Is very simple and stores the outgoing email in your Outlook sent items box.

This is how I bulk email send blind CCs to all customers in groups of 50, the email adresses are all in an MSACCESS table that is the Datasource of my ADODCEmail:-

Sub SendAllEmail(Recipients As Integer)
Dim RecipientAddress As String
On Error GoTo SAEError
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
If Recipients < 51 Then AdodcEmail.Recordset.MoveFirst
MAPIMessages1.Compose
MAPIMessages1.MsgSubject = EmailSubjectBox
MAPIMessages1.MsgNoteText = EmailMessageBox
For a = 1 To Recipients
MAPIMessages1.RecipIndex = a - 1
X = AdodcEmail.Recordset.Fields(&quot;FirstName&quot;) & &quot; &quot; & AdodcEmail.Recordset.Fields(&quot;LastName&quot;)
MAPIMessages1.RecipDisplayName = X
MAPIMessages1.RecipAddress = AdodcEmail.Recordset.Fields(&quot;EmailURL&quot;)
MAPIMessages1.RecipType = 3 'blind carbon copy
AdodcEmail.Recordset.MoveNext
Next
MAPIMessages1.Send False
EndSAE:
MailHelpLabel.Caption = a - 1 & &quot; Customers have been sent an Email.&quot;
If a - 1 <> Recipients Then MailHelpLabel.Caption = MailHelpLabel.Caption & &quot; Not all of the Emails were sent. Check the [SentItems] and [Outbox].&quot;
On Error GoTo 0
Exit Sub

SAEError:
Beep
MsgBox &quot;Fault in sending Email&quot;, 16, &quot;WARNING&quot;
If MAPISession1.SessionID > 0 Then MAPISession1.SignOff
Resume EndSAE

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top