Question:
How can I connect to an SMTP server through an application developed using VB?
azod0285
2007-01-16 12:33:42 UTC
I wanna develop an E-mail client using VB as frontend. Is there a way to connect to an SMTP server through this application? Or is there any alternative which I can adopt? Pls help with this regard!
Six answers:
MinstrelInTheGallery
2007-01-16 12:48:05 UTC
First, you need to know what the SMTP commands are. This is how you send email through an SMTP server. See Source #1



Second, you need to use the Winsock control to communicate those commands to the mail server. See Source #2



Third, you also need to know what that POP3 and/or IMAP commands are as well. At this point, you can only send email. You probably need to receive it, too. See Source #3



Example:



Winsock1.RemoteHost = "mail.mysite.com"

Winsock1.RemotePort = 25

Winsock1.Connect

Winsock1.SendData "HELO local.domain.name"
sunil p
2007-01-16 20:27:30 UTC
First you configure your SMTP server as a outgoing mail server to outlook express or any other mail client which is supported by your software, then try to connect it from your software.
Raghavendra Mudugal
2007-01-16 21:53:28 UTC
Hello,



According to my knowledge, It will be better in you use, CDO (Collaboration Data Objects), OR MAPI (Message Application Programming Interface) to fulfill your work.



They are the best ways to use, if you talk about SMTP or POP. Previously, I have created a mail client, using these tools.



An Example:-



Sending Email:



Set objEmail = CreateObject("CDO.Message")

objEmail.From = "monitor1@fabrikam.com"

objEmail.To = "admin1@fabrikam.com"

objEmail.Subject = "Atl-dc-01 down"

objEmail.Textbody = "Atl-dc-01 is no longer accessible over the network."

objEmail.Send



Sending Email without Installing the SMTP Service:



Set objEmail = CreateObject("CDO.Message")

objEmail.From = "admin1@fabrikam.com"

objEmail.To = "admin2@fabrikam.com"

objEmail.Subject = "Server down"

objEmail.Textbody = "Server1 is no longer accessible over the network."

objEmail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objEmail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _

"smarthost"

objEmail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objEmail.Configuration.Fields.Update

objEmail.Send





Hope this helps.
Special Ed
2007-01-16 12:55:51 UTC
Here is a nice little intro to SMTP and Winsock that I have used several times over my career.



Intro : http://www.vbip.com/winsock/winsock_smtp.asp



Accompanying Sample Apps in Winsock : http://www.vbip.com/winsock/index.asp



Enjoy!
loopy_and_yoshi
2007-01-16 14:06:36 UTC
Winsock1.RemoteHost = "mail.acme.com"

Winsock1.RemotePort = 1998

Winsock1.Connect
Richard H
2007-01-16 13:14:49 UTC
check out http://www.pscode.com for great source code examples


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...