Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
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!
 Architect Forums - SalesLogix Scripting & Customization
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Send an email from an SLX form
Rick Smith
Posts: 96
 
Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Aug 06 3:38 PM
fiogf49gjkf0d
Thought I'd share an experience I had this week trying to get a form to send an email. Seemed easy enough, just instantiate a CDO.Message object, set the parameters and call .Send. Worked fine on my machine, which I later discovered is because it is running its own SMTP server. When I released it to a colleague, it failed. Then tried adding the parameters suggested by Ryan in this thread:
http://www.slxdeveloper.com/forum.aspx?forumid=2000&postid=2162#2162
When I called the send command, I received an error that appears to be due to McAfee antivirus blocking port 25...

Then tried using the SalesLogix Mail Client as described in this article:
http://www.slxdeveloper.com/page.aspx?id=35&articleid=38
but got errors I couldn't solve.

Finally, I figured that since all our users will have Outlook on their machine, I'd try sending the email using Outlook. Here's the code that is working, at least in limited tests:

Sub SendOutlookEmail(sFrom, sTo, sCc, sSubject, sBody)
Dim objOutlook
Set objOutlook = Application.CreateObject("Outlook.Application")
Dim objMailMessage
Set objMailMessage = objOutlook.CreateItem(0) ' Mail message
objMailMessage.To = sTo
objMailMessage.Subject = sSubject
objMailMessage.Body = sBody
objMailMessage.Send
Set objMailMessage = Nothing
Set objOutlook = Nothing
End Sub

If anyone has caveats or other suggestions I'm certainly open to them!

Rick
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 06 8:37 AM
fiogf49gjkf0d
That seems simple enough. We only use Outlook as our email client. Not sure what caveats there will be doing it that way.

Just curious though, all our SLX clients automatically log into Outlook. Is this the case for you? If so, why wouldn't standard SLX procedures do this without issue (I am assuming that clients are doing mail merges, etc from the client.)

John G.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 06 1:36 PM
fiogf49gjkf0d
The caveat is the security prompts after Outlook 2000 SP1. You can use something like Redemption to get around it or just have your users deal with it. Ideally it'd be better to utilize SalesLogix's External MAPI handler (which bypasses the prompts) but they haven't nor is there any indication they'd ever let anyone use it. Probably from fear that it'll turn their application into a spamming platform.
[Reply][Quote]
Rick Smith
Posts: 96
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 06 9:53 PM
fiogf49gjkf0d
I realize now that there is a SLX function - Application.BasicFunctions.ComposeEmail - but haven't found any code examples. Is this using Outlook or another mechanism?

And yes, users do automatically login to Outlook, _except_ the occasional odd user such as HelpDesk that isn't set up to login to an Outlook mailbox.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 06 12:52 PM
fiogf49gjkf0d
ComposeEmail is very limited. It basically just opens a new e-mail window and leaves it at that (it does also return a boolean indicating if it was sent or not). You don't get to provide any other fields than just the address to send to.

Application.BasicFunctions.QueMessage is more flexible. You can supply the body of the e-mail, the subject, addresses (To, CC, BCC) and even an attachment path to include. However, it won't just automatically send it in the background (I assume that is what you are after?)

If you want it sent in the background, you either have to write Outlook code like was mentioned earlier, however, you'll have the nasty prompt from the Outlook Object Model Guard unless you install something like Redemption on all machines and use that.

The route I would likely take is to use a table in the database, the info get's flagged there, and then there is some server process that reads those entries and sends out the email. That way you can just use straight SMTP. You could also use KnowledgeSync, SQL Notification Services, or even just SQL SendMail for that as well.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 06 12:56 PM
fiogf49gjkf0d
Quote:
Originally posted by Rick Smith

Then tried adding the parameters suggested by Ryan in this thread:
http://www.slxdeveloper.com/forum.aspx?forumid=2000&postid=2162#2162
When I called the send command, I received an error that appears to be due to McAfee antivirus blocking port 25...


That doesn't make sense. If it is using a remote SMTP server then it is using the remote server's port 25. If McAfee is blocking outbound traffic to port 25 then that would mean they could not use a POP3 account on the pc either (since it will make outbound calls to an SMTP server for sending mail as well). Do you know if this is the case?

One great test is to telnet into the SMTP server from the problem machine and manually issue all SMTP calls. I've outlined how to do that here: http://ryanfarley.com/blog/archive/2006/01/09/14877.aspx

-Ryan
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 12:22 AM
fiogf49gjkf0d
QueMessage is basically a mailto: proxy, or at least it acts like one.

Ryan's right about the object guard which creates the security prompts. SalesLogix logging in to email does nothing to circumvent the protection either.

I have a checklist that determines if I use Outlook or a server based process. If the user needs a record of the transaction, preferably in their client and want full control over sending then I use Outlook. If I can somehow talk them out of it, I'll stick with the server.
[Reply][Quote]
Jeff Crawford
Posts: 52
 
Re: Send an email from an SLX formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 4:23 PM
fiogf49gjkf0d
If you don't mind using open source, there is a nice project called vbSendmail.dll, which can be found at http://www.freevbcode.com/ShowCode.Asp?ID=109 The project complies a DLL that must be registered, but the interface is very simple to use and can very powerful and flexible. It is able to do things like HTML emails and multiple file attachments. Keep in mind as with all DLL solutions, every machine that will be running the code, needs a copy of the registered component.

He's an example one off code...

Set poSendMail = CreateObject("vbSendMail.clsSendMail")
poSendMail.SMTPHost = txtServer.Text
poSendMail.From = txtFrom.Text
poSendMail.FromDisplayName = txtFromName.Text
poSendMail.Recipient = txtTo.Text
poSendMail.RecipientDisplayName = txtToName.Text
poSendMail.ReplyToAddress = txtFrom.Text
poSendMail.Subject = txtSubject.Text
poSendMail.Attachment = txtFileName.text 'attached file path
poSendMail.Message = txtMsg.Text
poSendMail.Send
Set poSendMail = Nothing
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 10:28:18 AM