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
url
optional. Link or links (comma separated) to be included as email attachments. Supports links to pdf.co output files, files from Google Drive, Dropbox. For uploading files via PDF.co API please check Files Upload section. If you are randomly gettingToo Many Requests
orAccess Denied
error for your input url, please try to addcache:
to enable built-in url caching.from
required - from field with sender name and email, for example:John Doe
to
required - to field with receiver name and email, e.g.Partner
subject
required - subject for the outgoing emailbodytext
plain text version of outgoing email messagebodyhtml
html version of outgoing email messagesmtpserver
required smtp server address. To learn how to setup smtp details, please check heresmtpport
smtp port. To learn how to setup smtp details, please check heresmtpusername
required smtp server username. To learn how to setup smtp details, please check heresmtppassword
required smtp server password. If you use Gmail then you need to generate app specific password as instructed here. To learn how to setup smtp details, please check hereasync
optional. Runs processing asynchronously. ReturnsJobId
that you may use with/job/check
to check state of the background job (possible states:working
,failed
,aborted
andsuccess
). Must be one of:true
,false
.profiles
optional. Must be a String. Use this parameter to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.- Method: POST
- URL: /v1/email/send
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/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://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/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
url
required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly gettingToo Many Requests
orAccess Denied
error for your input url, please try to addcache:
to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strongAES
encryption with your own keys). Click here to learn more.inline
optional.false
by default. Inasync
mode it returnsbody
with the content of the output json (with the links to the output).async
optional. Runs processing asynchronously. ReturnsJobId
that you may use with/job/check
to check state of the background job (possible states:working
,failed
,aborted
andsuccess
). Must be one of:true
,false
.profiles
optional. Must be a String. Use this parameter to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.- Method: POST
- URL: /v1/email/decode
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/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://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/email-extractor/sample.eml",
"inline": true,
"async": false
}'
[POST] /email/extract-attachments
url
required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly gettingToo Many Requests
orAccess Denied
error for your input url, please try to addcache:
to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strongAES
encryption with your own keys). Click here to learn more.inline
optional.false
by default. Inasync
mode it returnsbody
with the content of the output json (with the links to the output).async
optional. Runs processing asynchronously. ReturnsJobId
that you may use with/job/check
to check state of the background job (possible states:working
,failed
,aborted
andsuccess
). Must be one of:true
,false
.profiles
optional. Must be a String. Use this parameter to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.- Method: POST
- URL: /v1/email/extract-attachments
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/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://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/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
- cURL - Extract Email Attachments
- cURL - Get Email Information
- cURL - Send Email
Copyright © 2016 - 2023 PDF.co