These instructions show how to add an SMTP server to an existing Mail account, but you can also add these settings at the account creation stage.
Go to Mail -> Preferences (⌘,). On the account you want to edit, click the tab that says Server Settings, then click the Outgoing Mail Account dropdown and select Edit SMTP Server List....
Next, click the + under the list of SMTP servers, and add a new one.
Then enter the server details:
Now the SendGrid SMTP Server can be specified on the Accounts tab of the Preferences window in the Outgoing Mail Account dropdown. Once this is selected, mail sent out of Apple Mail going forward will use the SMTP server chosen until specified otherwise.
Unfortunately, there is not an easy way to add SMTP API headers to a message in Mail.
Mail will sometimes attach images in a way that is incompatible with other email readers. However, this behavior can be changed so that Mail will send more traditional non-inline attachments.
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes.
If you wish to restore the normal behavior of Mail, repeat the steps above while using the following command:
defaults write com.apple.mail DisableInlineAttachmentViewing -bool no.