How to send email from vb6.0. That you can't find in Microsoft Outlock Express...

Posted on 2006-05-24
Last Modified: 2012-06-21

Need sourcecode to send a email from vb6.0, but the user can't see the mail sent anyware...

How can this be done ???

Need the sourcecode for this ASAP.


Question by:team2005
    LVL 3

    Expert Comment

    If you want to start an email session using VB. You should start an MAPISession (Which will be property of MAPI32.dll in your machine). Once you given your authentication etc. there using MAPISession.SignOn(), you have to start a MAPIMessage(). This will give you all the features of email i.e. creating a new email, retriving an email, replying an email, accessing address book, sending an email etc. To attach an document in the email body using the functions AttachmentName and AttachmentPathName of MAPIMessage class. Try out these things. It is very easy to get the help for these topics in VB help. Search help for word "MAPI".

    LVL 2

    Author Comment


    Using MAPISession wil show the sent email, and this i dont want...

    So how to send a hidden email ???


    LVL 3

    Expert Comment

    I donot know exact way... But if it is urgent.. u can do round way..After sending the mail..delete from the sent box.

    LVL 9

    Accepted Solution

    The only real answer is to Open the connection to an SMTP server and do it directly.

    One of the many SMTP clients on PLanet source code that you could butcher...

    His frmSMTP shows a classic example of Connect/Response for a simple SMTP connection...

    However go try it yourself on your own mailserver, and see this commuication first hand... (i have indented the lines that you need to type, do not indent or prefix any line when communicating with the server but do press ENTER on each of these input lines!)

    Start Run

    And you should get a response, so now you ‘say hello’
    (HELO also works but depends on what SMTP server you are using as to whether it makes any difference – for Exchange Server EHLO will suffice)And a stream of acceptable formats will be displayed. This basically is the method of the server telling the mail client what services and capabilities are available from the server… (a ‘220’ and ‘250’ message is pretty much an OK)

    Now type
               MAIL FROM:EmailAddressOfSender
    And then
               RCPT TO:RecipientsEmailAddress
    Once you are at this point you can do lots of things but normally you would just want to send a message….

                DATA (then press enter)
    As you can see you have to type your message and then finish it with <EnterKey> then a ‘.’ Then another <EnterKey>
    The SMTP server will then queue the message and usually give a ‘250’ denoting the unique identifier of the message..
    Now that the message is sent you issue a ‘QUIT’ command to instruct the server to terminate the link and free the socket resources..

    Thats why spamming' so easy, theres not much to verify really who sent the message (but the server knows whether your IP number is within its acceptable range of sending clients unless it is what is known as an 'open-relay').

    Try it out, great fun for all!

    LVL 9

    Expert Comment

    Thanks Venabili.. Is useful reference for any language on the same question too..


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    The viewer will learn how to implement Singleton Design Pattern in Java.
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

    730 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

    18 Experts available now in Live!

    Get 1:1 Help Now