-
smtp
I haven't posted in some time in this forum...so first HALOOOOOOOOOOOOOOOOOOO HALOOOOOOOOOOOO
Secondly, I dont want to use outlook to send mail from a vb app...I want to use SMTP. What I need to do is grab some data from a sql database (which I've done)...
Now how do I send mail using SMTP in VB ?
Examples would be nice :).
Thanks,
Jon
-
Hey Jon, sup.
Have you seen this article - SMTP
-
if you don't want to use MAPI (which I believe is what RobDog's link uses) then you can use the Winsock control to interact with the server...I have an example around here someplace, I'll look for it.
-
Unfortunately, if you have Anti Virus software running, it will sometimes detect that it's a virus or a worm when working with email programs. Especially when using scripting.
-
It's ASP.NET actually. Using the System.Web.Mail namespace. So
if the underlying calls of it are MAPI then my mistake, but I'm
not sure what it actually is using. Still new to .NET.
-
Quote:
Originally posted by RobDog888
Hey Jon, sup.
Have you seen this article - SMTP
Ya but i cant have this as a web app sending mail...
I need an executable...where are the vb.net folks?
No one has an example of using smtp in vb.net??
I guess Ill start playing artound tomorrow with it.
Thanks folks
Jon
-
Ok, here's basics of SMTP.
Default port: 25
connect, then send the following (with a vbCrLf at the end of each):
"helo"
you'll get a response
"mail from [email protected]"
another response
"rcpt to [email protected]"
another response
"data"
response
"subject This is the Subject"
no response
...rest of message here...
to "close" the email send a single '.' followed by vbCrLf
you'll get a response, then send "quit" to end the session.
-
Re: smtp
If you want to do it properly, then there are three things you need to do:
- Find the IP address of the mail transfer agent (MTA) of the recipient. This is done by resolving the MX record for the domain to an IP address. This can be done using an API function.
DnsQuery - Make a connection to the users MTA through WinSock on port 25.
- Send the e-mail using the SMTP protocol.
This means the user doesn't have to enter the address of a SMTP relay, such as their ISP's server. You should notify the user when you plan to send e-mail as a matter of courtusy(sp?) and also as mentioned earlier, if a virus scanner or firewall, picks it up they user will then know what your application is doing and is more likely to allow it through.