Send emails from a VB application

Posted on 2003-10-30
Last Modified: 2010-05-03
I use CDONTS to send emails from my web app. I have SMTP services installed on my Web Server.
But let me ask you guys - Can I send emails from a standalone VB app without having any email client on ?
Question by:jitganguly
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
LVL 70

Expert Comment

by:Éric Moreau
ID: 9654487
Sure, have a look at the free vbSendMail component that is using SMTP :

Expert Comment

ID: 9654989
Try this:
'Only for win2000
    Set objMail = CreateObject("CDONTS.Newmail")
    objMail.subject = " iThread Default Package "
        FilePath1 = "C:\iThread\iMail\iMailDefault\" & g_EventID & "_" & g_EventName & "\picture.jpg"
        FilePath2 = "C:\iThread\iMail\iMailDefault\" & g_EventID & "_" & g_EventName & "\audio.wav"
        FilePath3 = "C:\iThread\iMail\iMailDefault\" & g_EventID & "_" & g_EventName & "\default.bmp"
    objMail.To = ""
    objMail.bcc = ""
    objMail.From = ""
    objMail.subject = "Default Multimedia Test"
    objMail.body = "This is an auto email sent by a remote iThread system. This mail may have 1, 2, or 3 attached files."
    objMail.Importance = 2
    objMail.BodyFormat = 0
    objMail.mailformat = 0
    objMail.attachfile (FilePath1)          
    objMail.attachfile (FilePath2)      
    objMail.attachfile (FilePath3)        

   Set objMail = Nothing  


~ fantasy ~
LVL 20

Author Comment

ID: 9655110
1. I do not want to use 3rd party dlls
2. I am running on NT

Don't yu have something like CDONTs concept of VBScript ? I just need to send a mail to some guys after running a VB app. VB app runs on a workstation and I cannot keep outlook client on all the time (Its a Blloberg machine)
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Accepted Solution

fantasy1001 earned 50 total points
ID: 9655264
Can you use MAPI:
A good and details example is this:

                                                                 ~ Fantasy ~

Expert Comment

ID: 9655565
You can use MAPi controls from your vb app to send mails. There is a MAPi sample also available with Visual Studio or you can have a look at Microsoft site or use SMTP.ocx which is freely available on the net.

Expert Comment

ID: 9656397
But don't we need to configure SMTP server..

I mean if i want to just send it thru a desktop(without IIS) can i do that..
LVL 70

Expert Comment

by:Éric Moreau
ID: 9656755
>1. I do not want to use 3rd party dlls

Since you have complete source code, you can include it into your actual project!

Expert Comment

ID: 9656784
Yes you can do that with smtp.ocx. You need to provide the mail server ip address and user login/pwd details. Its very esy to use the ocx.
LVL 20

Author Comment

ID: 9658201
I looked at the article and ran it. It works fine when my outlook client is on. Otherwise it asks for a MS exchange settings.

Question - Can I have that running without running Outlook client or any email client ?

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

729 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