MailEnable Enterprise Guide
Developers / Using the COM component
In This Topic
    Using the COM component
    In This Topic

    This component can be used in any application that supports COM. For example, this component can be used in an ASP page to send email from a web application. This component will work against any SMTP mail server, not just MailEnable. This component is 32bit only. You will not be able to access this DLL from a 64bit application, or from a website running as 64bit. The COM component allows email to be sent to a mail server (this does not need to be a MailEnable mail server). Features include:        

    The COM component allows easy integration of emailing sending from within any COM supporting application. It not only supports sending email to a MailEnable server, but also can be used to send email to any SMTP compatible mail server.

    Properties

    Property

    Explanation

    AttachmentFilename

    The name of the file that to add as an attachment.

    AttachmentName

    The name to call the attachment.

    AuthenticationMode

    Allows use of  SMTP authentication.

    0 = No SMTP authentication

    1 = SMTP authentication. You must populate the Username and Password properties in order to authenticate

    ContentType

    The ContentType of the email you are trying to send. For instance, if you wish to send a HTML email, use this property to set the content type to “text/html”.

    ErrorString

    This contains the full English language description of the last error. If you encounter an error, you can check this string for a more detailed error.

     

     

    MailBCC

    This is list of email addresses to BCC the email to. When using multiple email addresses, separate them with a semi-colon ";".

    MailCC

    This is list of email addresses to CC the email to. When using multiple email addresses, separate them with a semi-colon ";".

    MailCCDisplayName

    This is list of email addresses that are the display name corresponding to the email address set in MailCC. This list is optional. When using multiple email addresses, separate them with a semi-colon ";".

    MailFrom

    This is the email address of the sender.

    MailFromDisplayName

    The display name of the MailFrom email address. This is the friendly name that the end user will see instead of the email address. For example, you may place the full name of the sender, or the department from which the email is coming from.

    MailTo

    The email address to send the email to. To send to multiple email addresses, separate the emails with a semi-colon ";".

    MailToDisplayName

    This is the display name that will be shown as the To address. It is usually the full name of the recipient (e.g. "John Smith")

    Messagebody

    The message contents.

    MessageBodyText

    An optional property used to force the content for the textual content of the message. If the property is not set, MailEnable will generate a textual version of the message from the HTML content supplied (assuming the ContentType is set as text/html.

    Password

    Password to be used for SMTP authentication.

    Postoffice

    The post office name for the user

    Server

    The email server to connect to. If none is supplied, it will try to connect to the local machine.

    ServerPort

    The port to connect to. The default is 25.

    Subject

    The subject of the email message.

    Username

    Username to be used for SMTP authentication

    Methods

    Method

    Explanation

    AddHeader

    Adds a custom header to the email. Be careful when using this function, as incorrectly formed headers could prevent the mail from being sent.

    ClearHeaders

    Clears any custom headers that have been added with AddHeader. This would be used to send more than one message (i.e. put this call between the sends).

    SendMessage

    Send the email that has been configured with the options. The function will return zero for failure and number greater than zero for success.

    SetDefault

    Clears all the settings back to their default.

    ClearAttachments

    Clears the attachments.

    By setting the ContentType value to text/html, the component will generate a HTML and Plain Text representation of the message encapsulated in MIME format.  You need only to set the ContentType property to text/HTML and, when the SendMessage method is called, the component generates the MIME encapsulated message with a multipart alternative content boundary. This boundary then contains respective text/plain and text/HTML boundaries. The mail client then determines which of the alternative content types it wants to read - based on the capabilities of the mail client or the users settings.  If you set the MessageBody and MessageBodyPlain properties of the component, it will not generate a textual representation of the message and will use the property value specified for MessageBodyPlain.

    Advanced settings

    Server wide options for the MEMail component can be configured through the editing of Windows registry keys. If the registry key does not exist it will need to be added. These settings affect all uses of the component on the server.

    The values are located under the following registry branch:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mail enable\mail enable\Components\MEMail

     

    Value

    Value Type

    Description

    Allow attachments

    DWORD

    1 (default) = attachments can be added to emails

    0 = attachments cannot be added to emails

    Attachment Path

    String

    The path must include this string. If the postoffice or mailbox property value has been set on the object then the following variables can be used in the path:

    %POSTOFFICE%

    %MAILBOX%

    If these values have been used in the path, but are not provided when someone is using the component then the path from "Default Attachment Path" will be used. The variables above cannot be used in the "Default Attachment Path" setting.

    Default Attachment Path

    String

    This path will be used if no path has been set in the "Attachment Path" setting.