How do I send email on behalf of my customers?

There are three options for sending email on behalf of your customers, and each one has its own benefits and drawbacks. You can:
  1. Send from your domain directly on behalf of your customers. This option will use your domain for the From email. You can change the From name, but the email address will use your domain.
  2. Verify individual email addresses from your customer’s domain to send from that specific email address.
  3. Verify your customer’s entire domain and send from any address on that domain.
This chart shows how an example app called plumbercrm.com could use each method and how this would look for each option as it relates to from name, from address, and reply-to address for your recipients.
If your product or agency sends email on behalf of customers, like the imaginary CRM for plumbers from our chart, how do you choose which method is right for you? It really depends on the type and volume of email you’ll be sending, and on your customer’s expectations for those messages.
When you login to Postmark, you’ll see a menu item called ‘Sender Signatures’ and when you select it you’ll see an option to ‘Add a new signature or domain.' Click here and you’ll be given two choices, verify a domain or an email address with what we call a Sender Signature.

Sending from your domain

This is the fastest way to send for your customers because they don’t need to take any action outside of your app to send email. Another big advantage to this method is your customers don’t have to worry about setting up DKIM, SPF, or DMARC. You can manage all of those email authentication protocols for them.
You can change the From name and ReplyTo address in your code when sending with SMTP. There are a variety of ways to accomplish this in your code, but the main thing to remember is you need to set this information in the header for SMTP messages.
If you are sending with the Postmark API you can set the From and ReplyTo for each message. You can see what you’d need to update with the example values sender@example.com and reply@example.com below:
{
  "From": "sender@example.com",
  "To": "receiver@example.com",
  "Cc": "copied@example.com",
  "Bcc": "blank-copied@example.com",
  "Subject": "Test",
  "Tag": "Invitation",
  "HtmlBody": "<b>Hello</b>",
  "TextBody": "Hello",
  "ReplyTo": "reply@example.com",
  "Headers": [
    { 
      "Name": "CUSTOM-HEADER", 
      "Value": "value"
    }
  ],
  "TrackOpens": true
}
This isn’t the best method if your customers want to send email from their own domain, so if that’s a concern for your customers then you should consider one of the following methods.

Verifying an email address in the Postmark interface

Verifying an email address is a really great if your customers need to send from their own domain and you don’t want to ask them to update their DNS records. To send with this method, Postmark needs to know the email address your customers will be using. We’ll send them an email with a link they need  to click to verify their email address. One place you can manage this setting is in the Postmark interface.
After you select ‘Add Sender Signature’ from the Sender Signatures page, fill in the full name and email address you want to use. Remember, this email address will need to be setup and accepting email so you or your customer can verify it by following a link in the next step. 
Select ‘Create Signature’ and your customer will receive a confirmation email from Postmark to verify their email address. This message will look like the one pictured here, and your customers will need to follow the link to verify their email address.

Verifying a domain in the Postmark interface

This option takes a bit more time for your customers to set up to get started, but it’s worth it. They can build on their domain’s email reputation and will be able to send from any address on their domain. To get started your customers will need to add SPF and DKIM records to the DNS records for their domain.
If you choose to  verify a domain, Postmark will ask you to enter the domain you’d like to verify. Then on the next page, you’ll get a DKIM key and SPF record to add to the DNS for the domain you’re verifying. Your customers will need to add those values to their DNS. Like everything related to DNS, it can take some time for these records to propagate. Standard practice says to give them up to 48 hours to show up, but it normally doesn’t take that long.

Verifying an email address or domain with the Postmark API

Like I mentioned earlier, if you’re sending on behalf of a ton of customers you probably don’t want to have to manually add each domain or sender signature to your domain. This is where the Postmark API can do some of the heavy lifting for you!
You’ll need to use the Postmark API to create a Sender Signature to verify an individual email address or a domain. The first thing you need to know is an email address your customers want to verify. Remember, your customers can’t verify email addresses from free email providers like Gmail with Postmark.
Once you have your customers email address, send that email address to our Create Sender Signature endpoint, and the user will get an email from Postmark asking them to click to verify their email address. You should let your customers know an email will be coming from Postmark and they can confirm their email address in that message. 
If you’re new to Postmark’s API you can see how a call to create a sender signature works with the Postmark API Explorer. You’ll need an account token to see the create a sender signature endpoint in action. Paste in your account token, fill in the values for FromEmail , Name , and ReplyToEmail , and try it out.
Here’s an example of the response I got from Postmark’s API when creating a Sender Signature using my account:
{
"Domain": "shanerice.com",
"EmailAddress": "shanestestingagain@shanerice.com",
"ReplyToEmailAddress": "shanestestingagain@shanerice.com",
"Name": "Shane Rice",
"Confirmed": false,
"SPFVerified": true,
"SPFHost": "shanerice.com",
"SPFTextValue": "v=spf1 a mx include:spf.mtasv.net ~all",
"DKIMVerified": false,
"WeakDKIM": false,
"DKIMHost": "",
"DKIMTextValue": "",
"DKIMPendingHost": "20141002020044.pm._domainkey.shanerice.com",
"DKIMPendingTextValue": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCWHAVJiCzhjMobE7Dbq3FH9Q45iZzuxpTI6OtKfS7udD6nwxPWvBCJ/cLSzJN9MWDdBHL9ZWKI5HcP4ywXwZoK01K1dYxpa233FGjsNxFTD5Jz6sOukLRMVapL8oM6wNoR6WWDaeoqG7YBwaRh+zdqT1x/z0XMeNNObrQzhTBNIwIDAQAB",
"DKIMRevokedHost": "",
"DKIMRevokedTextValue": "",
"SafeToRemoveRevokedKeyFromDNS": false,
"DKIMUpdateStatus": "Pending",
"ReturnPathDomain": "",
"ReturnPathDomainVerified": false,
"ReturnPathDomainCNAMEValue": "pm.mtasv.net",
"ID": 629154
}
Using our  Domains API, you can add a Domain to your Postmark account and get back the information you need to verify it. The API response when creating a Domain only slightly differs from the response you get when creating a Sender Signature using the API:
{
  "Name": "newdomain.com",
  "SPFVerified": false,
  "SPFHost": "newdomain.com",
  "SPFTextValue": "v=spf1 a mx include:spf.mtasv.net ~all",
  "DKIMVerified": false,
  "WeakDKIM": false,
  "DKIMHost": "",
  "DKIMTextValue": "",
  "DKIMPendingHost": "20131031155228.pm._domainkey.newdomain.com",
  "DKIMPendingTextValue": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFn...",
  "DKIMRevokedHost": "",
  "DKIMRevokedTextValue": "",
  "SafeToRemoveRevokedKeyFromDNS": false,
  "DKIMUpdateStatus": "Pending",
  "ReturnPathDomain": "pmbounces.newdomain.com",
  "ReturnPathDomainVerified": false,
  "ReturnPathDomainCNAMEValue": "pm.mtasv.net",
  "ID": 36736
}
	

When you create a Domain using the API, the values DKIMPendingHost and DKIMPendingTextValue are also created (same as when you add a Sender Signature using the API). Your customers will need to add this DKIM record to their DNS records using the DKIMPendingHost (for the TXT record's host) and DKIMPendingTextValue (for the TXT record's value) returned for the added Domain. They’ll also need to create or update their SPF record. If they don’t have an SPF record then they can add v=spf1 a mx include:spf.mtasv.net ~all , or can add include:spf.mtasv.net  to their existing SPF settings. 

Once Postmark sees these DKIM values and a SPF record with spf.mtasv.net in the DNS records your customer will be able to send from any email address on their domain.

Still need help? Contact Us Contact Us