VB6 application to send Mail without Outlook

Posted on 2008-11-05
Last Modified: 2010-04-21
Is there a way to make a VB6 application send a mail without relying on Outlook.  I would like source code rather than components as I can't download freeware onto a production server.  I have something like this which works in ASP, but if you have something better please let me know.

Dim iMsg,objSendMail
Dim iConf
Dim Flds
Dim strNotes
Dim strSmartHost

Const cdoSendUsingPort = 1
StrSmartHost = "XXX"

Set objSendMail = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
 'set the CDOSYS configuration fields to use port 25 on the SMTP server
With Flds
.Item("") = cdoSendUsingPort
.Item("") = strSmartHost
.Item("") = 10
End With
strnotes = strnotes & "<font color= red>" & "Project_Area: " & request.Form("Department")  & "<BR>"
strnotes = strnotes & "Other_Department: " & request.Form("Other_Department") & "<BR>"
strnotes = strnotes & "area: " & request.Form("area ")& "<BR>"
With objSendMail
    .From = "aa"
    .To = "BB"            
    .Subject = Request.Form("Subject") & " - " & Request.Form("Project_Title")
    .HTMLBody = strnotes
End With
Question by:AlHal2
    LVL 69

    Accepted Solution


    because you have all source code, you can embed it directly into your application (even if I wouldn't).

    Author Comment

    Why wouldn't you embed it directly?
    What I really mean to ask is whether you feel it's safe.
    LVL 69

    Expert Comment

    by:Éric Moreau
    I prefer to keep it as a separate DLL that is easily re-usable accross different projects.

    Also if you modify it, you recompile it, you re-deploy it and all your applications have access to the newer version.

    Author Closing Comment


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    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…

    733 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

    24 Experts available now in Live!

    Get 1:1 Help Now