Search Results for

    Show / Hide Table of Contents

    Plugin: SMTP

    Introduction

    SMTP plugin allows you to send email via SMTP, which means you can easily integrate it into an existing SMTP server by minor modifications in the SMTP plugin configuration.

    Features

    Send an email

    There is one method here to allow the user to send an email from Casewhere to the external system.

    Method Name: SendEmail

    Input

    • subject: The email's subject. This field is required.
    • body: The email's content, it can be plain text or text with HTML format. This field is required.
    • to: The list of recipient email addresses in the serialized JSON format. This field is required.
    • cc: The list of CC email addresses in the serialized JSON format. This field is optional.
    • bcc: The list of BCC email addresses in the serialized JSON format. This field is optional.
    • isHtml: Field value is either true or false (false is default), it supports display HTML in content email. This field is optional.
      • If true, the email's content displays with HTML format
      • If false, the email's content doesn't display with HTML format although it contains HTML
    • attachments: the serialized JSON string of attachments. This field is optional.

    Follow the below sample:

        var bytes = Encoding.ASCII.GetBytes("text");
        var attachments = new List<Dictionary<string, string>>();
        attachments.Add(new Dictionary<string, string>
        {
            { "Name", "text.txt" },
            { "Content", Convert.ToBase64String(bytes, 0, bytes.Length)  }
        });
    
        var mailParameters = new Dictionary<string, string>()
        {
            { "subject", "Subject email" },
            { "body", "Content email" },
            { "isHtml", true },
            { "to", JsonConvert.SerializeObject(new List<string> { "casewhere@globeteam.com" }) },
            { "cc", JsonConvert.SerializeObject(new List<string> { "casewhere@globeteam.com" }) },
            { "bcc", JsonConvert.SerializeObject(new List<string> { "casewhere@globeteam.com" }) },
            { "attachments", JsonConvert.SerializeObject(attachments) }
        };
    

    This is sample email: smpt_email_sample

    Use the Invoke method in IPluginApi to call SendEmail feature:

        IPluginApi.Invoke(string pluginName, string methodName, IDictionary<string, Object> parameters)  
    

    Output

    The method returns data with two fields IsSuccess, Error.

    Example

        var pluginApi = ctx.Use<IPluginApi>(); 
    
        // Prepare parameters
        var parameters = new Dictionary<string, string>()
        {
            { "subject", "Subject email" },
            { "body", "Content email" },
            { "isHtml", "true" },
            { "to", JsonConvert.SerializeObject(new List<string> { "casewhere@globeteam.com" }) },
            { "cc", JsonConvert.SerializeObject(new List<string> { "casewhere@globeteam.com" }) },
            { "bcc", JsonConvert.SerializeObject(new List<string> { "casewhere@globeteam.com" }) }
        };
    
        // Invoke plugin
        var pluginResult = pluginApi.Invoke("CWMail", "SendEmail", parameters);
    
        var isSuccess = pluginResult.Value<bool>("IsSuccess");
    
    

    Installation

    Requirements

    • Casewhere v2.6.0 or later.

    Configuration

    • Username: SMTP username.
    • Password: SMTP password.
    • EmailAddress: The sender's email address.
    • DisplayName: The sender's name.
    • SMTP: SMTP server name or IP address.
    • Port: SMTP transactions's port
    • EnableSsl: option to enable Secure Sockets Layer (SSL) in order to encrypt the connection. Value is true or false.

    Example

    {
        "Username": "Username",
        "Password": "Password",
        "EmailAddress": "no-reply@application.com",
        "DisplayName": "Sample application",
        "SMTP": "application.com",
        "Port": 587,
        "EnableSsl": true
    }
    

    Releases

    1.0.0 - 23/03/2022

    Changelog

    • Send an email.

    Download (login required) SMTP plugin v1.0.1

    Roadmap

    • Send test email
    • Previewing email
    • Email mapping
    In This Article
    Back to top Generated by DocFX