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 Doe <[email protected]>
[email protected], Susan McLaren <[email protected]>
[email protected], "McLaren, Susan" <[email protected]>
If you create XML for SOAP requests manually, you need to encode the < and & characters in string values as <
and &
like this:
XML
or put the values inside CDATA:
XML
Example
Sample Code
C#
string login = "[email protected]";
string password = "p@ssword";
string from = "[email protected]";
string to = "[email protected]";
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 = "[email protected]";
String password = "p@ssword";
String from = "[email protected]";
String to = "[email protected]";
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>[email protected]</From>
<To>[email protected]</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>[email protected]</From>
<To>[email protected]</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>