Join Wintertainment 2021 to share your stories, have fun, earn community badges, and more!

SendEmail Operation

Applies to QAComplete 12.94 SaaS, last modified on December 06, 2021

Sends an email to one or more addresses.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object containing the login information for QAComplete.

From  :  string, required

Address that will appear as the e-mail’s sender.

To  :  string, required

Recipient’s address, or a comma-separated list of addresses. You can specify the To and CC addresses separately.

CC  :  string

Address to send a copy of the email to, or a comma-separated list of addresses.

Subject  :  string, required

Email subject.

EmailBody  :  string, required

Email message body. Can include HTML markup.

Result

None.

Remarks

From, To, Subject, and EmailBody must be non-empty.

You can specify email addresses in the following formats:

john@example.com
John Doe <john@example.com>
john@example.com, Susan McLaren <susan@example.com>
john@example.com, "McLaren, Susan" <susan@example.com>

If you create XML for SOAP requests manually, you need to encode the < and & characters in string values as &lt; and &amp; like this:

XML

<To>John Doe &lt;john@example.com&gt;</To>

or put the values inside CDATA:

XML

<To><![CDATA[John Doe <john@example.com>]]></To>

Example

Sample Code

C#

string login = "john@example.com";
string password = "p@ssword";

string from = "noreply@example.com";
string to = "susan@example.com";
string subject = "Test";
string message = "This is a test e-mail.";

ServiceSoapClient service = new ServiceSoapClient();

// Preparing AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = loginInfo.ProjId;

service.SendEmail(authData, from, to, "", subject, message);

Java

String login = "john@example.com";
String password = "p@ssword";

String from = "noreply@example.com";
String to = "susan@example.com";
String subject = "Test";
String message = "This is a test e-mail.";

ServiceSoap service = new Service().getServiceSoap12();

// Preparing AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(loginInfo.getProjId());

service.sendEmail(authData, from, to, "", subject, message);

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 587 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/SendEmail"
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SendEmail xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <From>noreply@example.com</From>
      <To>susan@example.com</To>
      <Subject>Test</Subject>
      <EmailBody>This is a test email.</EmailBody>
    </SendEmail>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 595 {Insert an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SendEmail xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <From>noreply@example.com</From>
      <To>susan@example.com</To>
      <Subject>Test</Subject>
      <EmailBody>This is a test email.</EmailBody>
    </SendEmail>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 303 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SendEmailResponse xmlns="http://www.pragmaticsw.com/" />
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 313 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SendEmailResponse xmlns="http://www.pragmaticsw.com/" />
  </soap12:Body>
</soap12:Envelope>

See Also

Helper Operations
SOAP API Reference

Highlight search results