Web API Reference Guide > Available API Methods > Configuration Management Methods > The emailSend Method

The emailSend Method

This action allows you to send email.

Version: 1.3

Required Permissions: Full

HTTP method: POST

Supported by Editions: All

Request Parameters:

Parameter

 Type

Required

Description

to

String

Yes

Valid email address of a recipient.

toName

String

No

Name the recipient.

from

String

Yes

Valid email address from your domain.

fromName

String

No

This is name appended to the from email field.

subject

String

Yes

the subject of your email.

templateName

String

Yes

The template name without an extension .phtml.

templateParams

Array

No

Parameters that will be assigned to your template.

headers

Array

No

Add a raw header line, either in name => value, or as a single string 'name: value'.

html

Boolean

No

The content type: ‘true’ for html, ‘false’ for plain text. Default is true.

Expected Response Code: 200 OK. For more information see Response Format.

Response Type: status

Possible Action Specific Error Codes:

HTTP Code

 Error Code

Description

500

internalServerError

The system could not send message, possibly due to a transport error.

500

smtpHostsIsMissing

Smtp host is missing in configuration.

500

smtpPortIsMissing

Smtp port is missing in configuration

500

smtpConnectionClassIsMissing

Smtp connection class is missing in configuration

500

emailSendTransportIsMissing

Email transport is missing in configuration

Example

Usage Example

Request

POST /ZendServer/Api/emailSend

to=example%40example.com&toName=Example&from=from%40example.com&fromName=From+Example&subject=Example&templateName=test&templateParams%5BfirstName%5D=Teddy&templateParams%5BlastName%5D=Roosevelt&headers%5B0%5D=X-API-Key%3A+Admin

Response

<?xml version="1.0" encoding="UTF-8"?>

<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.3">

<requestData>

<apiKeyName>angel.eyes</apiKeyName>

<method>emailSend</method>

</requestData>

<responseData>

<status>OK</status>

</responseData>

</zendServerAPIResponse>

 

Read Also

  Available API Methods    
  Configuration Management Methods