Skip to content

Generic Vapor Email#2

Draft
madsodgaard wants to merge 14 commits intomainfrom
api
Draft

Generic Vapor Email#2
madsodgaard wants to merge 14 commits intomainfrom
api

Conversation

@madsodgaard
Copy link
Collaborator

@madsodgaard madsodgaard commented Jun 4, 2020

This PR serves as a discussion and W.I.P for this repository and the API.

EmailClient

So far I've implemented EmailClient that providers must conform to, which allows to send a EmailMessage.

EmailAddress

You specify the sender and recipients with the EmailAddress type, which can be initialized by a string in the following formats:

  • "test@vapor.codes" -> name: nil, email: "test@vapor.codes"
  • "Vapor <test@vapor.codes>" -> name: "Vapor", email: "test@vapor.codes"

EmailAddressRepresentable

Another thing I've added is a EmailAddressRepresentable protocol, which can be added to a User for example and then you can do:

let user: User  = ...
let email = EmailMessage(from: "test@test.com", to: user)
req.email.send(email)

@madsodgaard
Copy link
Collaborator Author

Just reposting @mcdappdev reply to the previous PR, as I closed that and opened this one instead.

@madsodgaard this is exciting! I'm def +1 for a repo like this. The only thing I would suggest after perusing the source is making text on VaporEmail optional as well - sometimes people send out only HTML with no text component (although not recommended) and so I think this library shouldn't make any assumptions about that.

@tanner0101 tanner0101 added the enhancement New feature or request label Jul 11, 2020
Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great so far. :)

Base automatically changed from master to main March 12, 2021 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants