AlHal2
asked on
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.Configur ation")
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
.Update
End With
strnotes = strnotes & "<font color= red>" & "Project_Area: " & request.Form("Department") & "<BR>"
strnotes = strnotes & "Other_Department: " & request.Form("Other_Depart ment") & "<BR>"
strnotes = strnotes & "area: " & request.Form("area ")& "<BR>"
With objSendMail
.From = "aa"
.To = "BB"
.Subject = Request.Form("Subject") & " - " & Request.Form("Project_Titl e")
.HTMLBody = strnotes
.Send
End With
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.Configur
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
.Update
End With
strnotes = strnotes & "<font color= red>" & "Project_Area: " & request.Form("Department")
strnotes = strnotes & "Other_Department: " & request.Form("Other_Depart
strnotes = strnotes & "area: " & request.Form("area ")& "<BR>"
With objSendMail
.From = "aa"
.To = "BB"
.Subject = Request.Form("Subject") & " - " & Request.Form("Project_Titl
.HTMLBody = strnotes
.Send
End With
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.
Also if you modify it, you recompile it, you re-deploy it and all your applications have access to the newer version.
ASKER
Thanks.
ASKER
What I really mean to ask is whether you feel it's safe.