6/18/2025 8:28:14 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.
|
|
|
|
Autosending Email from Server
Posted: 26 Mar 07 2:54 PM
|
fiogf49gjkf0d We have a requirement to send an email to a history contact after the history is completed. Looking to do this on the server to avoid all the issues of having to configure clients to send email in the background (setting up SMTP, relays, etc.)
Looking for sample code on how this would be done using .NET where an EXE would be created that is run every so often to check the table for new history and send the email.
Thanks much in advanced! John G. |
|
|
|
Re: Autosending Email from Server
Posted: 26 Mar 07 4:19 PM
|
fiogf49gjkf0d A simple route would be to have a .NET exe that you could just kick off from the windos scheduler, scan the history table for all new items *since the last time it ran*, logs the new execution time, and sends the emails.
It would probably work to not have to keep track of all the specific historyid values you have sent to, but instead just log the current time and then each time you just check for all new items since the last time it ran.
As far as sending the e-mails:
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add("sendtome@email.com"); message.Subject = "This is my e-mail..."; message.From = new System.Net.Mail.MailAddress("fromme@email.com"); message.IsBodyHtml = false; message.Body = "This is my e-mail message!"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("mySMTPserver"); //this line can be omitted if the SMTP server accepts relaying from the current machine smtp.Credentials = new NetworkCredential("username", "mypassword"); smtp.Send(message);
Keep in mind, if you're using .NET 2.0, you'll want to use the newer System.Net.Mail namespace, not the older System.Web.Mail.
You can see a whole lot of good stuff on System.Net.Mail here: http://www.systemnetmail.com/
-Ryan |
|
|
| |
| |
| |
|
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!
|
|
|
|
|
|
|
|