[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB6 application to send Mail without Outlook

Posted on 2008-11-05
4
Medium Priority
?
524 Views
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("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_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
    .Send
End With
0
Comment
Question by:AlHal2
  • 2
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1000 total points
ID: 22885183
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).
0
 

Author Comment

by:AlHal2
ID: 22886100
Why wouldn't you embed it directly?
What I really mean to ask is whether you feel it's safe.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22886969
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.
0
 

Author Closing Comment

by:AlHal2
ID: 31513462
Thanks.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 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