• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

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

Hi!

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.

Thanks

Tor
0
team2005
Asked:
team2005
  • 2
  • 2
1 Solution
 
sreenathkCommented:
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".

Sreenath
0
 
team2005Author Commented:
Hi!

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

So how to send a hidden email ???

Thanks

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

Sreenath
0
 
lojk.Net and Infrastructure ConsultantCommented:
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...

http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=25919&lngWId=1

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
Cmd /k telnet YOURSMTPMAILSERVERADDRESS 25

And you should get a response, so now you ‘say hello’
         EHLO
(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….

Type
            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!

0
 
lojk.Net and Infrastructure ConsultantCommented:
Thanks Venabili.. Is useful reference for any language on the same question too..

:-)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now