Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(smtp-client): add plugin (#4585)
* smtp-client * fix plugin ref * cloud settings --------- Co-authored-by: Daniel Sogl <daniel@sogls.de>
- Loading branch information
1 parent
126d44f
commit 2b6c297
Showing
5 changed files
with
110 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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Smtp Client | ||
|
||
```text | ||
$ ionic cordova plugin add cordova-plugin-smtp-client | ||
$ npm install @awesome-cordova-plugins/smtp-client | ||
``` | ||
|
||
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/smtp-client/) | ||
|
||
Plugin Repo: [https://github.com/CWBudde/cordova-plugin-smtp-client](https://github.com/CWBudde/cordova-plugin-smtp-client) | ||
|
||
## Supported platforms | ||
|
||
* Android | ||
* iOS | ||
|
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Smtp Client | ||
|
||
``` | ||
$ ionic cordova plugin add cordova-plugin-smtp-client | ||
$ npm install @awesome-cordova-plugins/smtp-client | ||
``` | ||
|
||
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/smtp-client/) | ||
|
||
Plugin Repo: [https://github.com/CWBudde/cordova-plugin-smtp-client](https://github.com/CWBudde/cordova-plugin-smtp-client) | ||
|
||
|
||
|
||
## Supported platforms | ||
|
||
- Android | ||
- iOS | ||
|
||
|
||
|
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
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; | ||
|
||
/** | ||
* @name Smtp Client | ||
* @description | ||
* @usage | ||
* ```typescript | ||
* import { SmtpClient } from '@awesome-cordova-plugins/smtp-client/ngx'; | ||
* | ||
* constructor(private smtpClient: SmtpClient) { } | ||
* | ||
* ... | ||
* | ||
* this.smtpClient.sendMail(mailSettings, success, failure); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
pluginName: 'SMTPClient', | ||
plugin: 'cordova-plugin-smtp-client', | ||
pluginRef: 'smtpClient', | ||
repo: 'https://github.com/CWBudde/cordova-plugin-smtp-client', | ||
install: 'ionic cordova plugin add cordova-plugin-smtp-client', | ||
platforms: ['Android', 'iOS'], | ||
}) | ||
@Injectable() | ||
export class SmtpClient extends AwesomeCordovaNativePlugin { | ||
/** | ||
* The sendMail function. | ||
* | ||
* var mailSettings = { | ||
* emailFrom: "emailFrom@domain.com", | ||
* emailTo: "emailTo@domain.com", | ||
* smtp: "smtp-mail.domain.com", | ||
* smtpUserName: "authuser@domain.com", | ||
* smtpPassword: "password", | ||
* attachments: ["attachment1", "attachment2"], | ||
* subject: "email subject", | ||
* textBody: "write something within the body of the email" | ||
* }; | ||
* | ||
* var successCallback = function(message) { | ||
* alert(message); | ||
* } | ||
* | ||
* var errorCallback = function(message) { | ||
* alert("Error sending the email"); | ||
* } | ||
* | ||
* @param mailSettings | ||
* @param successCallback | ||
* @param errorCallback | ||
* @returns {Promise<any>} | ||
*/ | ||
@Cordova() | ||
sendMail(mailSettings: any, successCallback: any, errorCallback: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* You can call isLoaded to check if client is loaded. | ||
* | ||
* @returns {Promise<any>} | ||
*/ | ||
@Cordova() | ||
isLoaded(): Promise<any> { | ||
return; | ||
} | ||
} |