VB6 application to send Mail without Outlook

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("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 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
Who is Participating?
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
check http://www.freevbcode.com/ShowCode.Asp?ID=109

because you have all source code, you can embed it directly into your application (even if I wouldn't).
AlHal2Author Commented:
Why wouldn't you embed it directly?
What I really mean to ask is whether you feel it's safe.
Éric MoreauSenior .Net ConsultantCommented:
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.
AlHal2Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.