Email Send and Decode
Functions to send email (with attachments), decode email, extract attachments from email.
For converting email to pdf please see /pdf/convert/from/email
Available Methods
[POST] /email/send
Attributes |
---|
url required URL to the source file. Supports links from Google Drive, Dropbox, and PDF.co built-in files storage. To upload files via API, Check out the Files Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf ) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption. |
from required The “From” field with sender name and email, e.g. John Doe . |
to required The “To” field with receiver name and email, e.g. Partner . |
subject required subject for the outgoing email. |
bodytext plain text version of the outgoing email message. |
bodyhtml HTML version of the outgoing email message. |
smtpserver required SMTP server address. To learn how to setup SMTP details, please check here |
smtpport required SMTP port, To learn how to setup SMTP details, Please check here |
smtpusername required SMTP server username, To learn how to setup SMTP details, Please check here |
smtppassword required SMTP server password, If you use Gmail then you need to generate an app-specific password as instructed here. To learn how to setup SMTP details, Please check here |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configuration for fine-tuning and extra options, Explore PDF.co knowledgebase for profile examples, The input must be in string format. |
- Method: POST
- URL: /v1/email/send
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-info/sample.pdf",
"from": "John Doe <john@example.com>",
"to": "Partner <partner@example.com>",
"subject": "Check attached sample pdf",
"bodytext": "Please check the attached pdf",
"bodyHtml": "Please check the attached pdf",
"smtpserver": "smtp.gmail.com",
"smtpport": "587",
"smtpusername": "my@gmail.com",
"smtppassword": "app specific password created as https://support.google.com/accounts/answer/185833",
"async": false
}
Example responses
/email/send
{
"error": false,
"status": 200,
"remainingCredits": 60095
}
Code Snippet
CURL
curl --location --request POST 'https://api.pdf.co/v1/email/send' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-info/sample.pdf",
"from": "John Doe <john@example.com>",
"to": "Partner <partner@example.com>",
"subject": "Check attached sample pdf",
"bodytext": "Please check the attached pdf",
"bodyHtml": "Please check the attached pdf",
"smtpserver": "smtp.gmail.com",
"smtpport": "587",
"smtpusername": "my@gmail.com",
"smtppassword": "app specific password created as https://support.google.com/accounts/answer/185833",
"async": false
}'
[POST] /email/decode
Attributes |
---|
url required URL to the source file. Supports links from Google Drive, Dropbox, and PDF.co built-in files storage. To upload files via API, Check out the Files Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf ) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption. |
inline optional, false by default. with async mode enabled it returns body with the content of the output JSON (with the links to the output). |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configuration for fine-tuning and extra options, Explore PDF.co knowledgebase for profile examples, The input must be in string format. |
- Method: POST
- URL: /v1/email/decode
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/email-extractor/sample.eml",
"inline": true,
"async": false
}
Example responses
/email/decode
{
"body": {
"from": "test@example.com",
"fromName": "",
"to": [
{
"address": "test2@example.com",
"name": ""
}
],
"cc": [],
"bcc": [],
"sentAt": null,
"receivedAt": null,
"subject": "Test email with attachments",
"bodyHtml": null,
"bodyText": "Test Email Message with 2 PDF files as attachments\r\n\r\n",
"attachmentCount": 2
},
"error": false,
"status": 200,
"name": "sample.json",
"remainingCredits": 60095
}
Code Snippet
CURL
curl --location --request POST 'https://api.pdf.co/v1/email/decode' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/email-extractor/sample.eml",
"inline": true,
"async": false
}'
[POST] /email/extract-attachments
Attributes |
---|
url required URL to the source file. Supports links from Google Drive, Dropbox, and PDF.co built-in files storage. To upload files via API, Check out the Files Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf ) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption. |
inline optional, false by default. In async mode it returns body with the content of the output JSON (with the links to the output). |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configurations for fine-tuning and extra options, Explore PDF.co knowledgebase for profile examples, The input must be in string format. |
- Method: POST
- URL: /v1/email/extract-attachments
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/email-extractor/sample.eml",
"inline": true,
"async": false
}
Example responses
POST /email/extract-attachments
{
"body": {
"from": "test@example.com",
"subject": "Test email with attachments",
"bodyHtml": null,
"bodyText": "Test Email Message with 2 PDF files as attachments\r\n\r\n",
"attachments": [
{
"filename": "DigitalOcean.pdf",
"url": "https://pdf-temp-files.s3.amazonaws.com/2943e6bb80e646ec92e839292e95d542/DigitalOcean.pdf"
},
{
"filename": "sample.pdf",
"url": "https://pdf-temp-files.s3.amazonaws.com/e10e37fbb438432a83ece50ccdc719b3/sample.pdf"
}
]
},
"pageCount": 2,
"error": false,
"status": 200,
"name": "sample.json",
"remainingCredits": 60085
}
Code Snippet
CURL
curl --location --request POST 'https://api.pdf.co/v1/email/extract-attachments' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/email-extractor/sample.eml",
"inline": true,
"async": false
}'
Samples
- C# - Extract Email Attachments
- C# - Get Email Information
- C# - Send Email
- Java - Extract Email Attachments
- Java - Get Email Information
- JavaScript - Extract Email Attachments
- JavaScript - Get Email Information
- JavaScript - Send Email
- PHP - Extract Email Attchments
- PHP - Get Email Information
- PHP - Send Email
- PowerShell - Extract Email Attachments
- PowerShell - Get Email Information
- PowerShell - Send Email
- Python - Extract Email Attchments
- Python - Get Email Information
- Python - Send Email
- Salesforce - Extract Email Attchments
- Salesforce - Get Email Information
- Salesforce - Send Email
- cURL - Extract Email Attachments
- cURL - Get Email Information
- cURL - Send Email
Copyright © 2016 - 2023 PDF.co