-
Notifications
You must be signed in to change notification settings - Fork 729
feat: Support for AMP HTML Email #945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
aed430a
Support for AMP HTML Email
arun-tvs-sage 861f651
Merge branch 'main' into amp-email
arun-tvs-sage 019ecb9
squash merged main
arun-tvs-sage 73de797
Updated use_cases on sending amp email
arun-tvs-sage fb895a2
Merge branch 'main' into amp-email
thinkingserious 4d5aade
Updated test cases for AMP Emails and made few fixes for proper funct…
arun-tvs-sage 9f15627
Merge branch 'amp-email' of https://github.com/modernwarfareuplink/se…
arun-tvs-sage 1966526
Removed calling unittest from test_mail_helpers.py
arun-tvs-sage 3365a5f
Updated the year in LICENSE
arun-tvs-sage dd644c3
Wrapping up duplicate constants to global
arun-tvs-sage 68c5188
temp
arun-tvs-sage 11ea0e4
Rectify issues with tests and updated mail order logic
arun-tvs-sage 818a5bb
Merge branch 'main' into amp-email
arun-tvs-sage a9a6056
Resolved comments in test/test_mail_helpers.py
arun-tvs-sage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| from .content import Content | ||
| from .validators import ValidateApiKey | ||
|
|
||
|
|
||
| class AmpHtmlContent(Content): | ||
| """AMP HTML content to be included in your email.""" | ||
|
|
||
| def __init__(self, content): | ||
| """Create an AMP HTML Content with the specified MIME type and content. | ||
|
|
||
| :param content: The AMP HTML content. | ||
| :type content: string | ||
| """ | ||
| self._content = None | ||
| self._validator = ValidateApiKey() | ||
|
|
||
| if content is not None: | ||
| self.content = content | ||
|
|
||
| @property | ||
| def mime_type(self): | ||
| """The MIME type for AMP HTML content. | ||
|
|
||
| :rtype: string | ||
| """ | ||
| return "text/x-amp-html" | ||
|
|
||
| @property | ||
| def content(self): | ||
| """The actual AMP HTML content. | ||
|
|
||
| :rtype: string | ||
| """ | ||
| return self._content | ||
|
|
||
| @content.setter | ||
| def content(self, value): | ||
| """The actual AMP HTML content. | ||
|
|
||
| :param value: The actual AMP HTML content. | ||
| :type value: string | ||
| """ | ||
| self._validator.validate_message_dict(value) | ||
| self._content = value | ||
|
|
||
| def get(self): | ||
| """ | ||
| Get a JSON-ready representation of this AmpContent. | ||
|
|
||
| :returns: This AmpContent, ready for use in a request body. | ||
| :rtype: dict | ||
| """ | ||
| content = {} | ||
| if self.mime_type is not None: | ||
| content["type"] = self.mime_type | ||
|
|
||
| if self.content is not None: | ||
| content["value"] = self.content | ||
| return content |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ class MimeType(object): | |
| """ | ||
| text = "text/plain" | ||
| html = "text/html" | ||
| amp = "text/x-amp-html" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.