Solved

Sending Mail

Posted on 2004-04-27
6
208 Views
Last Modified: 2013-11-13
Please provide me the correct steps to be followed to while programming in VB to send a mail
0
Comment
Question by:sreeja
6 Comments
 
LVL 1

Accepted Solution

by:
craduza earned 125 total points
ID: 10936243
try this...it's the best..:D
just study the code..coz it's very easy...

http://www.freevbcode.com/ShowCode.Asp?ID=109
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10936324
Do you have any prerequisites? If not, go for the above suggested components. Its one of the best and most used components!
0
 
LVL 1

Assisted Solution

by:elatagaw
elatagaw earned 125 total points
ID: 11066423
try this code by:

'Martin Anbu Selvan
'St.joseph's college of Engineering,chennai.
'tissot_swiss@yahoo.com

'u need -5 combo boxes and 3 textboxes.1 command button,winsock control.

'declaration

const Cr = vbCrLf



Private Sub cmdSend_Click()
txtLog.Text = Empty
Socket.Close
Socket.RemoteHost = txtServer.Text
Socket.RemotePort = 25
Status "Connecting..."
Socket.Connect
End Sub
Public Sub Status(Txt As String)
txtStatus.Text = Txt
End Sub
Private Sub Ssocket_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Status "Error!"
End Sub
Private Sub Form_Load()
txtServer.AddItem "mta208.mail.scd.yahoo.com"
txtServer.AddItem "mc2.law16.hotmail.com"
End Sub
Private Sub Socket_Connect()
Dim Txt As String
Status "Connected"
Txt = ""
Txt = Txt & "HELO aaa" & Cr
Txt = Txt & "MAIL FROM: <" & txtFromAddress.Text & ">" & Cr
Txt = Txt & "RCPT TO: <" & txtTo.Text & ">" & Cr
Txt = Txt & "DATA" & Cr
Txt = Txt & "From: " & txtFromName.Text & "<" & txtFromAddress.Text & ">" & Cr
Txt = Txt & "Subject: " & txtSubject.Text & Cr
Txt = Txt & txtText.Text & Cr
Txt = Txt & Cr & Cr & "." & Cr
Txt = Txt & Cr & "quit"
Socket.SendData Txt
End Sub

Private Sub Socket_DataArrival(ByVal bytesTotal As Long)
Dim RText As String
Socket.GetData RText, vbString
txtLog.Text = txtLog.Text & RText
End Sub

Private Sub Socket_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Status "Error!"
End Sub

Private Sub Socket_SendComplete()
Status "Mail Sent."
End Sub

Private Sub Socket_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
Status "Sending mail..."
End Sub

Good Luck!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now