7/6/2025 10:29:35 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
How to code for sending Email ???
Posted: 06 Sep 10 10:36 PM
|
I would like to code for sending email by myself. Does anybody know how to code? Please give me for example.  |
|
|
|
Re: How to code for sending Email ???
Posted: 07 Sep 10 4:20 AM
|
Hi Suwisa,
here is a short example of using Application.BasicFunctions.QueMessage, which will open the email client with passed parameters:
Dim strTo, strCC, strBCC, strSubject, strBody, strAttachment
strTo = "me@myaccount.com" strCC = "" strBCC = "" strSubject = "test email" strBody = "Hello World" strAttachment = ""
Application.BasicFunctions.QueMessage strTo, strCC, strBCC, strSubject, strBody, strAttachment
Have a look at the SalesLogix LAN Developer Reference (search for "QueMessage") for more information.
Cheers, Thomas |
|
|
|
Re: How to code for sending Email ???
Posted: 07 Sep 10 8:39 AM
|
If you want to send emails automatically, you can use some code like the below. Note that this doesn't go through the email client. Also, if you want to create history records in SLX, you'd need to code that as well.
'Beginning of Standalone Script
option explicit
'Email constants Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort = 2 Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" Const cdoBasic = 1 Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername" Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
Main
Sub Main
Dim objConfig ' CDO.Configuration Dim strToEmailAddress ' To Address Dim strCCEmailAddress ' CC Address Dim strFromEmailAddress ' From Address Dim strEmailSubject ' Email Subject Dim strEmailBody ' Email body
' Get a handle on the config object and its fields Set objConfig = CreateObject("CDO.Configuration")
' Set config fields we care about
objConfig.Fields.Item(cdoSendUsingMethod) = cdoSendUsingPort objConfig.Fields.Item(cdoSMTPServer) = "smtp.server.com." objConfig.Fields.Item(cdoSMTPServerPort) = 25
'objConfig.Fields.Item(cdoSMTPAuthenticate) = cdoBasic 'objConfig.Fields.Item(cdoSendUserName) = "XXXX" 'objConfig.Fields.Item(cdoSendPassword) = "XXXX" objConfig.Fields.Update
strToEmailAddress = "bob@somewhere.com" strFromEmailAddress = "SLXService@somecompany.com" strEmailSubject = "Test Email" strEmailBody = "Testing" Sendmail strToEmailAddress, strCCEmailAddress, strFromEmailAddress, strEmailSubject, strEmailBody, 2, objConfig
Set objConfig = Nothing
End Sub
Function SendMail(strTo, strCC, strFrom, strSubject, strBody, msgType, objConfig)
Dim objMail
set objMail = CreateObject("CDO.Message")
set objMail.Configuration = objConfig
objMail.To = strTo objMail.CC = strCC objMail.From = strFrom objMail.Subject = strSubject
if msgType = 1 then objMail.TextBody = strBody end if
if msgType = 2 then objMail.HTMLBody = strBody end if
objMail.Send
set objConfig = Nothing set objMail = Nothing
End Function |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|