-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2fd274
commit 91d3e34
Showing
1 changed file
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,54 @@ | ||
Swift wrapper for the mailjet send API. With additional feature to archive attachments. | ||
Unofficial Swift wrapper for the [mailjet send API v3.1](https://dev.mailjet.com/email/guides/send-api-v31/). With additional feature to archive attachments. | ||
|
||
### Info | ||
|
||
This library only supports text messages (no HTML). All attachments will be archived in a single `attachments.zip' archive file. All JPEG files will be excluded from the archive and directly attached to the message. | ||
|
||
### Usage | ||
|
||
... | ||
##### Init the sender object with your credentials | ||
```swift | ||
let sender = MailjetSender(publicKey: "myPublicKey", privateKey: "myPrivateKey") | ||
``` | ||
|
||
##### Send the email | ||
```swift | ||
sender.send( | ||
from: "contact-us@your_domain.com", | ||
fromName: "Sender", | ||
to: "contact-us-inbox@your_domain.com", | ||
toName: "Support", | ||
replyTo: "reply_to@email.address", | ||
attachments: attachments, | ||
subject: "My subject", | ||
message: "My message" | ||
) | ||
``` | ||
|
||
### Fields | ||
|
||
`from`: Sender email address. | ||
|
||
`fromName`: Optional, sender name. | ||
|
||
`to`: Receiver email address. | ||
|
||
`toName`: Optional, sender name. | ||
|
||
`replyTo`: Optional, `Reply-To` address. | ||
|
||
`attachments`: Optional, set of attachments wrapped in `NamedFile` objects. | ||
|
||
`subject`: Subject of the email | ||
|
||
`message`: Message body | ||
|
||
`completion`: Optional, completion block that returns an error if occurred. Returns `nil` instead of error in case of success. | ||
|
||
### Installation | ||
|
||
##### SPM | ||
Repository: `https://github.com/numen31337/mailjet_sender.git`, Branch: `main` | ||
|
||
##### CocoaPods | ||
`pod 'MailjetSender', :git => 'https://github.com/numen31337/mailjet_sender.git'` |