Reading Email

There are several ways for to view email messages using Mailsac

Read an Email Message

../../_images/inbox_view_reading_mail.gif

View Emails from the main page of the Mailsac Website

../../_images/unified_inbox_reading_mail.gif

Read using the Unified Inbox

Read using curl. Requires JQ
curl -s -H "Mailsac-Key: YOUR_API_KEY_HERE" \
    -X GET https://mailsac.com/api/addresses/calendartrinity@mailsac.com/messages \
    | jq .[0]._id | \
    xargs -I {} curl -H "Mailsac-Key: YOUR_API_KEY_HERE" \
    -X GET https://mailsac.com/api/text/calendartrinity@mailsac.com/{}

# curl output
Dogtreats are good!
Read using Node.js. requires npm install superagent
const superagent = require('superagent')
const mailsac_api_key = 'YOUR_API_KEY_HERE'

superagent
  .get('https://mailsac.com/api/addresses/calendartrinity@mailsac.com/messages')
  .set('Mailsac-Key', mailsac_api_key)
  .then((messages) => {
      const messageId = messages.body[0]._id
      superagent
          .get('https://mailsac.com/api/text/calendartrinity@mailsac.com/' + messageId)
          .set('Mailsac-Key', mailsac_api_key)
              .then((messageText) => {
                  console.log(messageText.text)
              })
  })
  .catch(err => {
      console.log(err.message)
  })

/*
Dogtreats are good!
*/
Read using Python
import requests
from pprint import pprint

headers = {'Mailsac-Key': 'YOUR_API_KEY_HERE'}
url = 'https://mailsac.com/api/addresses/calendartrinity@mailsac.com/messages'
r = requests.get(url, headers=headers)
message_id =  r.json()[0]['_id']
url = 'https://mailsac.com/api/text/calendartrinity@mailsac.com/' + message_id
r = requests.get(url, headers=headers)
pprint(r.text)

'''
'Dogteats are good!'
'''

Inbox View

Enter the email address of the Inbox to be viewed in this box on the main page of the Mailsac Website

../../_images/main_page_inbox.png

An Inbox can be viewed by entering the URL for the Inbox in a browser address bar. The URL to view an Inbox always follows the format https://mailsac.com/inbox/EMAIL_ADDRESS

Any non-private email address can be viewed without creating an account. To view the images and links of a message a Mailsac account must be used. A free account can be created from the sign-up page

Unified Inbox

The Unified Inbox provides a way to view the mail of all private addresses for the logged in Mailsac account.

../../_images/unified_inbox_view.png

The Unified Inbox is useful for managing multiple email addresses.

REST API

The REST API is the preferred method for reading messages programmattically. The /api/addresses/:email/messages and /api/text/:email/:messageId endpoints documented in the REST API documentation.

  1. Generate an API by selecting API Keys from the Dashboard.
  2. Send email using curl or your favorite HTTP library. Code Examples

Reading with POP3

Reading via POP3 allows email clients to read email.

Authentication

POP3 uses a username and password for authentication. The API key or SMTP Key for your account can be used to read from any of your private addresses. Alternatively, you can use a per private address SMTP password. The per private address SMTP password can be set through using the Dashboard -> Manage Email Addresses -> Select the POP/SMTP button next to the email address -> Select Set New Password

../../_images/pop_smtp_set_password.png

Email Client Configuration

Configure your email client (Gmail, Apple mail, Thunberbird, Outlook, iPhone, etc) using these POP3 settings:

Hostname / Server poppy.mailsac.com
Email Address Private email address
Username Private email address
Password API Key or SMTP Key
Port 110
Auth Settings Password / allow plain / insecure

To configure a mail client for sending see the Sending Mail via SMTP Section.

Viewing Email Attachments

For private addresses, the Unified Inbox allows downloading of attachments. Email fetched from private addresses using POP3 from an email client such as Apple Mail or GMail, will include attachments.

Public email addresses disallow downloading attachments - you must download the entire message file, or fetch attachments programmatically using the API.

Attachments cannot be hosted publicly for download because attachments often contain viruses and spam.