Community
Showing results for 
Search instead for 
Do you mean 
Reply

Sending E-mails though Act! using the ACT.UI.Email library

Copper Super Contributor
Posts: 52
Country: United_Kingdom

Sending E-mails though Act! using the ACT.UI.Email library

Hi everyone,

 

Here's a quick sample of sending a single E-mail through Act! using the available classes and methods in ACT.UI.Email.

 

This sample utilizes the Send method but there are other methods such as SendActivityAsEmailSendEmailSendEmailToContact and SendOpportunityAsEmail.

 

if ((oApp.UIEmailManager.CanEmail() == true) && (oApp.UIEmailManager.IsSystemsSetup() == true))
            {
                //GET CONTACT VALUES
                string cEMail = oApp.ApplicationState.CurrentContact.ValidEmailAddress;
                string cFullName = oApp.ApplicationState.CurrentContact.FullName;
                string cFirstName = oApp.ApplicationState.CurrentContact.FirstName;

                DialogResult dr = MessageBox.Show("Are you sure you want to send an email to " + cFullName + " [" + cEMail + "]?", "Act!", MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (dr == DialogResult.Yes)
                {

                    //CREATE A NEW EMAIL OBJECT
                    EmailMessage e = oApp.UIEmailManager.CreateNewEmailMessage();

                    //ADD A TO AND CC
                    e.To.Add(new EmailRecipient(cEMail));
                    e.CC.Add(new EmailRecipient("another.test@address.com"));
                    e.BCC.Add(new EmailRecipient("yet.another@test.com"));

                    //SUBJECT LINE
                    e.Subject = "Are you living the exclamation " + cFirstName + "?";

                    //BODY
                    e.IsHTML = true;
                    e.Message = "<HTML><BODY><SPAN style=\"font-weight:bold; font-size:16pt; color:#fd5000;\">This is a test E-mail</SPAN></BODY></HTML>";

                    //RECORD HISTORY
                    e.HistoryType = Act.Framework.Preferences.Enums.EmailCreateHistoryType.SubjectAndMessage;

                    //SEND THE EMAIL
                    oApp.UIEmailManager.Send(e);

                    //TELL THE END-USER
                    MessageBox.Show("E-mail sent to " + cFullName + " [" + cEMail + "] successfully.", "Act!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("The E-mail system is not configured. You must complete the E-mail System Setup before you can continue.", "Act", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }

 

The code sample is also attached to this post.

 

Kind regards,

 

 

Russell 

Copper Super Contributor
Posts: 478
Country: Australia

Re: Sending E-mails though Act! using the ACT.UI.Email library

Thanks Russell

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6