Package com.netlang.mail
Class MailConnection
java.lang.Object
com.netlang.mail.NBaseMailer
com.netlang.mail.MailConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intThe type GMAILstatic intstatic final Stringstatic intThe type SMTPstatic intThe type YAHOO -
Constructor Summary
ConstructorsConstructorDescriptionMailConnection(com.netlang.resourceconfig.ResourceConfig rc) MailConnection(com.netlang.session.NetlangSession session, String resourceid) MailConnection(String resourceid) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close mailboxString[]getInbox()static voidvoidsendGMail(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) Send mail via GMAILvoidsendGMail(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType, String fromName, String replyTo) Send mail via GMAILvoidsendLive(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) Send mail via Microsoft LivevoidsendLive(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo) Send mail via Microsoft LivevoidvoidsendMail(String sender, String fromName, String replyTo, String mailTo, String mailCc, String mailBcc, String subject, String message, String contentType) voidsendMail(String sender, String fromName, String replyTo, String mailTo, String mailCc, String mailBcc, String subject, String message, String contentType, List<NetlangFile> attachments, List<File> attachmentsLocal) voidsendMicrosoft365(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo) Send mail via Microsoft Office 365 with SMTP AUTH Note that this is SMTP AUTH which is different from basic authentication.voidsendOutlook(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) voidsendSMTP(int type, String mailserver, int port, String protocol, String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, boolean authenticationRequired, boolean useSSL, boolean useTLS, String user, String password, String contentType) Send mail via SMTPvoidsendSMTP(int type, String mailserver, int port, String protocol, String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, boolean authenticationRequired, boolean useSSL, boolean useTLS, String user, String password, String contentType, List<byte[]> attachment, List<String> attachmentNames) Send mail via SMTPvoidsendSMTP(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) voidsendSMTP(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String protocol, String mailserver, int port, boolean useSSL, boolean useTLS) Connects to the specified SMTP server and sends an email.voidsendSMTP2(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo, String protocol, String mailserver, int port, boolean useSSL, boolean useTLS) Connects to the specified SMTP server and sends an email.voidsendYahoo(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType) Send mail via YAHOOvoidsendYahoo(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo) Send mail via YAHOOMethods inherited from class com.netlang.mail.NBaseMailer
send, send, setupServerSession
-
Field Details
-
PROVIDER_MICROSOFT_OFFICE_365
- See Also:
-
SMTP_PROVIDER
public static int SMTP_PROVIDERThe type SMTP -
GMAIL_PROVIDER
public static int GMAIL_PROVIDERThe type GMAIL -
YAHOO_PROVIDER
public static int YAHOO_PROVIDERThe type YAHOO -
MS360_PROVIDER
public static int MS360_PROVIDER
-
-
Constructor Details
-
MailConnection
- Throws:
com.net4z.APIException
-
MailConnection
- Throws:
Exception
-
MailConnection
public MailConnection(com.netlang.resourceconfig.ResourceConfig rc) throws com.net4z.APIException - Throws:
com.net4z.APIException
-
MailConnection
public MailConnection(com.netlang.session.NetlangSession session, String resourceid) throws com.net4z.APIException - Throws:
com.net4z.APIException
-
-
Method Details
-
main
- Throws:
Exception
-
close
public void close()Close mailbox -
getInbox
- Throws:
Exception
-
getFolderNames
- Throws:
Exception
-
getFolder
- Throws:
Exception
-
getFolder
- Throws:
Exception
-
sendMail
public void sendMail(String sender, String fromName, String replyTo, String mailTo, String mailCc, String mailBcc, String subject, String message, String contentType) throws Exception - Throws:
Exception
-
sendMail
- Throws:
Exception
-
sendMail
public void sendMail(String sender, String fromName, String replyTo, String mailTo, String mailCc, String mailBcc, String subject, String message, String contentType, List<NetlangFile> attachments, List<File> attachmentsLocal) throws Exception - Throws:
Exception
-
sendGMail
public void sendGMail(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) throws Exception Send mail via GMAIL- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-- Throws:
Exception
-
sendGMail
public void sendGMail(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType, String fromName, String replyTo) throws Exception Send mail via GMAIL- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-- Throws:
Exception
-
sendLive
public void sendLive(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) throws Exception Send mail via Microsoft Live- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-- Throws:
Exception
-
sendOutlook
public void sendOutlook(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) throws Exception - Throws:
Exception
-
sendLive
public void sendLive(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo) throws Exception Send mail via Microsoft Live- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-- Throws:
Exception
-
sendSMTP
public void sendSMTP(int type, String mailserver, int port, String protocol, String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, boolean authenticationRequired, boolean useSSL, boolean useTLS, String user, String password, String contentType) throws Exception Send mail via SMTP- Parameters:
type-mailserver-port-protocol-sender-mailTo-cc-bcc-subject-message-attachements-authenticationRequired-useSSL-useTLS-user-password-contentType-- Throws:
Exception
-
sendSMTP2
public void sendSMTP2(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo, String protocol, String mailserver, int port, boolean useSSL, boolean useTLS) throws Exception Connects to the specified SMTP server and sends an email.- Parameters:
sender- the senders namemailTo- the receiver(s)cc- the cc receiverbcc- the bcc receiversubject- the subjectmessage- the message body (plain or html depending on the content type)attachements- the path to the attachemntsuser- the user for authentication (optional)password- the password (optional)contentType- the content type, text/plain or text/htmlprotocol- SMTPS or SMTPmailserver- the address to the mail serverport- the mailserver's portuseSSL- if SSL should be useduseTLS- if TLS should be used.- Throws:
Exception
-
sendSMTP
public void sendSMTP(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String contentType) throws Exception - Throws:
Exception
-
sendSMTP
public void sendSMTP(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String protocol, String mailserver, int port, boolean useSSL, boolean useTLS) throws Exception Connects to the specified SMTP server and sends an email.- Parameters:
sender- the senders namemailTo- the receiver(s)cc- the cc receiverbcc- the bcc receiversubject- the subjectmessage- the message body (plain or html depending on the content type)attachements- the path to the attachemntsuser- the user for authentication (optional)password- the password (optional)contentType- the content type, text/plain or text/htmlprotocol- SMTPS or SMTPmailserver- the address to the mail serverport- the mailserver's portuseSSL- if SSL should be useduseTLS- if TLS should be used.- Throws:
Exception
-
sendSMTP
public void sendSMTP(int type, String mailserver, int port, String protocol, String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, boolean authenticationRequired, boolean useSSL, boolean useTLS, String user, String password, String contentType, List<byte[]> attachment, List<String> attachmentNames) throws Exception Send mail via SMTP- Parameters:
type-mailserver-port-protocol-sender-mailTo-cc-bcc-subject-message-attachements-authenticationRequired-useSSL-useTLS-user-password-contentType-- Throws:
Exception
-
sendYahoo
public void sendYahoo(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType) throws Exception Send mail via YAHOO- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-- Throws:
Exception
-
sendYahoo
public void sendYahoo(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo) throws Exception Send mail via YAHOO- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-- Throws:
Exception
-
sendMicrosoft365
public void sendMicrosoft365(String sender, String mailTo, String cc, String bcc, String subject, String message, String attachements, String user, String password, String contentType, String fromName, String replyTo) throws Exception Send mail via Microsoft Office 365 with SMTP AUTH Note that this is SMTP AUTH which is different from basic authentication. SMTP AUTH will NOT be deprecated after oct 1 2022. Also note that SMTP AUTH must be enabled per users mailbox or on the tenant in Office 365 admin portal.- Parameters:
sender-mailTo-cc-bcc-subject-message-attachements-user-password-contentType-fromName-replyTo-- Throws:
Exception
-
getProvider
-