public final class EmailMethods extends Object
Constructor and Description |
---|
EmailMethods(io.toro.martini.email.EmailClient emailClient) |
Modifier and Type | Method and Description |
---|---|
static GloopModel |
readEmail(String protocol,
String login,
String password,
String host,
int port,
String folder,
boolean delete,
boolean debug)
Read an email.
|
static GloopModel |
sendEmail(String protocol,
String login,
String password,
String server,
int port,
String from,
List<GloopModel> to,
List<GloopModel> cc,
List<GloopModel> bcc,
String subject,
boolean isHtml,
String body,
List attachments,
List<GloopModel> headers)
Send an email.
|
static String |
sendEmail(String body,
String protocol,
String login,
String password,
String server,
int port,
String from,
Object to,
Object cc,
Object bcc,
String subject)
Send an email.
|
static String |
sendEmail(String body,
String protocol,
String login,
String password,
String server,
int port,
String from,
Object to,
Object cc,
Object bcc,
String subject,
List<DataSource> attachments)
Send an email.
|
static String |
sendEmail(String body,
String protocol,
String login,
String password,
String server,
int port,
String from,
Object to,
Object cc,
String subject)
Send an email.
|
static String |
sendEmail(String body,
String protocol,
String login,
String password,
String server,
int port,
String from,
Object to,
Object cc,
String subject,
List<DataSource> attachments)
Send an email.
|
static String |
sendEmail(String body,
String protocol,
String login,
String password,
String server,
int port,
String from,
Object to,
String subject)
Send an email.
|
static String |
sendEmail(String body,
String protocol,
String login,
String password,
String server,
int port,
String from,
Object to,
String subject,
List<DataSource> attachments)
Send an email.
|
@Autowired EmailMethods(io.toro.martini.email.EmailClient emailClient)
public static String sendEmail(String body, String protocol, String login, String password, String server, int port, String from, Object to, String subject) throws ToroException
Send an email.
Example usage:
String body = 'Body of the email.' body.sendEmail( 'smtp', 'user@gmail.com', 'password', 'smtp.gmail.com', 587, 'from@gmail.com', 'to@gmail.com', 'Subject' )
body
- the body of the emailprotocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to address (can be String
, String[]
, or Collection<String>
)subject
- email subjectToroException
public static String sendEmail(String body, String protocol, String login, String password, String server, int port, String from, Object to, String subject, List<DataSource> attachments) throws ToroException
Send an email.
Example usage:
String body = 'Body of the email.' def attachments = ... body.sendEmail( 'smtp', 'user@gmail.com', 'password', 'smtp.gmail.com', 587, 'from@gmail.com', 'to@gmail.com', 'Subject', attachments )
body
- the body of the emailprotocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to address (can be String
, String[]
, or Collection<String>
)subject
- email subjectattachments
- optional list of email attachmentsToroException
public static String sendEmail(String body, String protocol, String login, String password, String server, int port, String from, Object to, Object cc, String subject) throws ToroException
Send an email.
Example usage:
String body = 'Body of the email.' body.sendEmail( 'smtp', 'user@gmail.com', 'password', 'smtp.gmail.com', 587, 'from@gmail.com', 'to@gmail.com', [ 'cc1@gmail.com', 'cc2@gmail.com' ], 'Subject' )
body
- the body of the emailprotocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to address (can be String
, String[]
, or Collection<String>
)cc
- CC address (can be String
, String[]
, or Collection<String>
)subject
- email subjectToroException
public static String sendEmail(String body, String protocol, String login, String password, String server, int port, String from, Object to, Object cc, String subject, List<DataSource> attachments) throws ToroException
Send an email.
Example usage:
String body = 'Body of the email.' def attachments = ... body.sendEmail( 'smtp', 'user@gmail.com', 'password', 'smtp.gmail.com', 587, 'from@gmail.com', 'to@gmail.com', [ 'cc1@gmail.com', 'cc2@gmail.com' ], 'Subject', attachments )
body
- the body of the emailprotocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to address (can be String
, String[]
, or Collection<String>
)cc
- CC address (can be String
, String[]
, or Collection<String>
)subject
- email subjectattachments
- optional list of email attachmentsToroException
public static String sendEmail(String body, String protocol, String login, String password, String server, int port, String from, Object to, Object cc, Object bcc, String subject) throws ToroException
Send an email.
Example usage:
String body = 'Body of the email.' body.sendEmail( 'smtp', 'user@gmail.com', 'password', 'smtp.gmail.com', 587, 'from@gmail.com', 'to@gmail.com', [ 'cc1@gmail.com', 'cc2@gmail.com' ], [ 'bcc1@gmail.com', 'bcc2@gmail.com' ], 'Subject' )
body
- the body of the emailprotocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to address (can be String
, String[]
, or Collection<String>
)cc
- optional CC address (can be String
, String[]
, or Collection<String>
)bcc
- optional BCC address (can be String
, String[]
, or Collection<String>
)subject
- email subjectToroException
public static String sendEmail(String body, String protocol, String login, String password, String server, int port, String from, Object to, Object cc, Object bcc, String subject, List<DataSource> attachments) throws ToroException
Send an email.
Example usage:
String body = 'Body of the email.' def attachments = ... body.sendEmail( 'smtp', 'user@gmail.com', 'password', 'smtp.gmail.com', 587, 'from@gmail.com', 'to@gmail.com', [ 'cc1@gmail.com', 'cc2@gmail.com' ], null, 'Subject', attachments )
body
- the body of the emailprotocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to address (can be String
, String[]
, or Collection<String>
)cc
- optional CC address (can be String
, String[]
, or Collection<String>
)bcc
- optional BCC address (can be String
, String[]
, or Collection<String>
)subject
- email subjectattachments
- optional list of email attachmentsToroException
@GloopObjectParameter(value="mailMetadata{\n mailMetadata#io.toro.martini.email.MailMetadata{\n }\n}") public static GloopModel sendEmail(@GloopParameter(choices={"smtp","smtps"},allowNull=false,allowOtherValues=true) String protocol, String login, String password, @GloopParameter(choices={"smtp.gmail.com","smtp.mail.yahoo.com","smtp-mail.outlook.com"},allowOtherValues=true,allowNull=false) String server, @GloopParameter(choices={"25","465","587"},allowOtherValues=true) int port, @GloopParameter(allowNull=false) String from, @GloopObjectParameter(value="to#io.toro.martini.email.Address[]{\n}") List<GloopModel> to, @GloopObjectParameter(value="cc#io.toro.martini.email.Address[]{\n}") List<GloopModel> cc, @GloopObjectParameter(value="bcc#io.toro.martini.email.Address[]{\n}") List<GloopModel> bcc, @GloopParameter(allowNull=false) String subject, @GloopParameter(defaultValue="false") boolean isHtml, String body, @GloopObjectParameter(value="attachments#io.toro.martini.email.DataSource[]{\n}") List attachments, @GloopObjectParameter(value="headers#io.toro.martini.email.Header[]{\n}") List<GloopModel> headers) throws ToroException
Send an email.
protocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordserver
- email server hostnameport
- email server port numberfrom
- from addressto
- to addresscc
- optional CC addressbcc
- optional BCC addresssubject
- email subjectisHtml
- whether to apply content type text/html
or text/plain
for the emailbody
- the body of the emailattachments
- optional list of email attachmentsheaders
- email headersToroException
- if an error occurs@GloopObjectParameter(value="output{\nmessages#io.toro.martini.email.Message[]{\n}\n}") public static GloopModel readEmail(@GloopParameter(choices={"imap","imaps","pop3","pop3s"},allowNull=false) String protocol, @GloopParameter(allowNull=false) String login, @GloopParameter String password, @GloopParameter(choices={"imap.gmail.com","pop.gmail.com","imap-mail.outlook.com","pop3.live.com","imap.mail.yahoo.com","pop.mail.yahoo.com"},allowNull=false,allowOtherValues=true) String host, @GloopParameter(choices={"993","995"},allowOtherValues=true) int port, @GloopParameter(choices="INBOX",allowOtherValues=true) String folder, @GloopParameter(defaultValue="false") boolean delete, @GloopParameter(defaultValue="false") boolean debug) throws ToroException
Read an email.
protocol
- protocol of the email serverlogin
- email server loginpassword
- email server passwordhost
- email server hostnameport
- email server port numberfolder
- delete
- if email is to be deleted after readingdebug
- whether or not to print debug information to the consoleToroException
- if an error occursCopyright © 2023. All rights reserved.