SendLetterAndAddress
Description
The SendLetterAndAddress() method is the simplest way to send a letter through the PostalMethods service.
With this method, you must create a letter with whitespace in the area showing through the envelope bottom window, according to the envelope type you wish to use. Letter templates are available for the various envelope types that PostalMethods supports.
Formal Definition
https://api.postalmethods.com/2009-02-26/PostalWS.asmx?op=SendLetterAndAddress
Input
| Property | Type | Comments |
|---|---|---|
| Username | String | As provided during registration |
| Password | String | As provided during registration |
| MyDescription | String | Up to 100 characters. Free text. User may add any text to help identify the request (UTF8) |
| FileExtension | String | Provide details regarding the files and templates used for this letter - either new or pre-uploaded. See the appendix at the bottom of this page |
| FileBinaryData | base64Binary | Attached document represented as binary data List of supported file types |
| WorkMode | Default or Production or Development | Indicates whether the letter should be processed completely ('Production') or only simulated as a test ('Development'). 'Default' will use the PostalMethods User's default Work Mode setting |
| AttentionLine1 | String | Up to 45 characters. Non-address data, such as company, name, position, department, etc. Line will not be printed when empty. At least one of the attention or company lines must contain data. |
| AttentionLine2 | String | Up to 45 characters. Non-address data, such as name, position, department, etc. Line will not be printed when empty |
| Company | String | Up to 45 characters. Company / Firm name. At least one of the attention or company lines must contain data. |
| Address1 | String | Up to 45 characters.Main delivery address (e.g., 123 Main St.) or PO Box. This line must contain data. |
| Address2 | String | Up to 45 characters. Secondary address unit (i.e., Additional address elements such as Apartment, Suite, Building, Room, etc.) |
| City | String | Up to 30 characters. Use 'FPO' or 'APO' when sending to U.S. Military destinations. This line must contain data. |
| State | String | Up to 30 characters. State or Region. Use 'AE', 'AP' or 'AA' when sending to U.S. Military destinations |
| PostalCode | String | Up to 15 characters. Provide postal code in a format used in the destination country. When destination country is the USA, use a ZIP+4 code. If ZIP+4 is not provided we will try to add it |
| Country | String | Up to 45 characters. Value is required only when destination country is different than the user's country. |
Output: SendLetterAndAddressResponse
| Element | Type | Comments |
|---|---|---|
| SendLetterAndAddressResult | int | In case of successful submission, a positive number is returned indicating the letter's unique identifier on the system. In case of failure, a negative number is returned indicating the failure reason. See the list of Web Service Result Codes. |
File Extension
Allowed Content:
- Upload a document per request: The extension of the attached document.
- Example:
pdf(see list of supported file types) - FileBinaryData must contain the binary representation of the document.
- Example:
- Refer to pre-uploaded files: The name(s) of a pre-uploaded document(s) according to order (semicolon as delimiter).
- Format:
MyFile:<finename1>.<extension1>;MyFile:<finename2>.<extension2>;... - Example: MyFile:File1.pdf;MyFile:File2.docx;...
- FileBinaryData must be empty.
- Format:
- Using a template and merge data: the name of a pre-uploaded template.
- Format:
MyTemplate:<filename>.<extension> - FileBinaryData may either be empty or contain a binary representation of values to be merged to this template in an XML format.
- Optional: you may specify additional pre-uploaded files to be added to the letter. Example: MyTemplate:File1.html;MyFile:File2.pdf;...
- Format:
Read this article for additional details.
Change Log
- Rename method name from "SendLetterAndAddressV2" to "SendLetterAndAddress"
- Delete field: "AttentionLine3"
- New feature: allow using templates, pre-uploaded documents and multiple documents
