Results 1 to 8 of 8

Thread: smtp

  1. #1

    Thread Starter
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    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

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Hey Jon, sup.

    Have you seen this article - SMTP
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439
    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.
    "I don't want to live alone until I'm married" - M.M.R.P

  4. #4
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349
    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.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    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

  7. #7
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439
    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.
    "I don't want to live alone until I'm married" - M.M.R.P

  8. #8
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: smtp

    If you want to do it properly, then there are three things you need to do:
    1. 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
    2. Make a connection to the users MTA through WinSock on port 25.
    3. 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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width