pp108 : SendMail

SendMail


This Web service operation is used to send a mail to the mail server.

SOAP Request
<SendMail xmlns="http://schemas.cordys.com/1.0/email">
    <to>
        <address>
            <displayName>Steve Buchanan</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
        <address>
            <displayName>Michael Suyama</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
    </to>
    <cc>
        <address>
            <displayName>Nancy Davolio</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
    </cc>
    <bcc>
        <address>
            <displayName>Laura Callahan</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
    </bcc>
    <subject><![CDATA[Mail subject]]></subject>
    <body><![CDATA[There is a meeting scheduled for 14:00 hrs today. Make it convenient to attend the same.
        Enclosed are some important documents to be discussed at the meeting today.]]>
    </body>
    <attachments>
        <attachment encoded="true" name="word.doc">
            SGkgZnJvbSBDaGlydXZvbHUgc3VkaGFrYXIu
        </attachment>
        <attachment encoded="false" name="text.txt">
            some plain ASCII content
        </attachment>
    </attachments>
    <from>
        <displayName>pamela</displayName>
        <emailAddress>[email protected]</emailAddress>
        <replyTo>[email protected]</replyTo>
    </from>
    <headers>
        <header name="header1">header value1</header>
        <header name="header2">header value2</header>
    </headers>
</SendMail>

Request Parameters

Parameter

Description

to

Specifies the address that the mail has to be sent to. Contains the address tag

cc

Specifies the addresses in the CC field that the mail has to be sent to. Contains the address tag.

bcc

Specifies the addresses that the mail has to be sent to. But the recipient details are invisible to other recepients of the message. Contains theaddresstag.

address

Contains the actual address that the mail has to be sent to. This has two tags:

  • displayName- The name to be displayed in the address
  • emailAddress- The actual email address that the mail has to be sent to

body

Contains the actual body of the message being sent. This takes an optional attribute 'type', which can be used when the text being sent is in HTML format. When this attribute is not mentioned, the default text type is 'normal'.

attachments

Contains attachments, if any, that are being sent with the message; contains the attachment tag.

attachment

Contains the actual attachment file being sent with the mail. This tag takes two attributes:

  • name- The name of the file being sent as attachment
  • encoded- A Boolean value that specifies whether the attachment is encoded or not. If 'true', the contents of the attachment are Base64 encoded. If 'false', the attachment is sent as a plain ASCII text file

from

Contains the details of the sender of the message. These details are dependent upon the mail provider.If this tag is not present, the sender details are taken from the e-mail profile that is stored in LDAP. If both the <from> tag and the e-mail profile are not present, a SOAP error is displayed. If the profile is not yet configured, set the profile using SetProfile API.

includeHeaders

When set to 'true', displays the header information of the mail.


SOAP Response
<SendMailResponse xmlns="http://schemas.cordys.com/1.0/email">
    <to>
        <address>
            <displayName>Steve Buchanan</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
        <address>
            <displayName>Michael Suyama</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
    </to>
    <cc>
        <address>
            <displayName>Nancy Davolio</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
    </cc>
    <bcc>
        <address>
            <displayName>Laura Callahan</displayName>
            <emailAddress>[email protected]</emailAddress>
        </address>
    </bcc>
    <subject><![CDATA[Mail subject]]></subject>
    <body type="html"><![CDATA[There is a meeting scheduled for 14:00 hrs today. Make it convenient to attend the same.
        Enclosed are some important documents to be discussed at the meeting today.]]>
    </body>
    <attachments>
        <attachment encoded="true" name="word.doc">
            SGkgZnJvbSBDaGlydXZvbHUgc3VkaGFrYXIu
        </attachment>
        <attachment encoded="false" name="text.txt">
            some plain ASCII content
        </attachment>
    </attachments>
    <from>
        <displayName>pamela</displayName>
        <emailAddress>[email protected]</emailAddress>
        <replyTo>[email protected]</replyTo>
    </from>
</SendMailResponse>