Package sk.iway.iwcm
Class SendMail
java.lang.Object
sk.iway.iwcm.SendMail
Odosielanie emailu, priklad telnet spojenia:
EHLO tau19.iway.sk
MAIL FROM:noreply@interway.sk
RCPT TO:veronika.husarova@employment.gov.sk
DATA
From:noreply@interway.sk
To:veronika.husarova@employment.gov.sk
Subject:test
Test
.
QUIT
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDescription of the Methodstatic StringcreateAbsolutePath(String htmlCode, String basePath) Vytvori absolutne cesty v zadanom HTML kodestatic StringcreateAbsolutePath(String htmlCode, javax.servlet.http.HttpServletRequest request) static StringgetDefaultSenderEmail(String module, String fallbackEmail) Return senderEmail of various email from config value moduleDefaultSenderEmail or defaultSenderEmail if module version is not defined.static StringgetDefaultSenderName(String module, String fallbackName) Return senderName of various email from config value moduleDefaultSenderName or defaultSenderName if module version is not defined.Vrati kodovanie pre email podla nastavenia servera, alebo ak nie je prazdne podla konfiguracnej premennej emailEncodingstatic StringgetFirstEmailAddress(String email) Ziska prvu email adresu zo stringu typu meno@domena.sk,ine@domena.sk (pre polia, ktore mozu mat len jeden email ako from a replyTo)getInlineAttachments(String htmlCode) Ziska zoznam inline priloh (obrazkov)static javax.mail.SessiongetSession(Properties props) static booleanisHtmlContent(String html) Otestuje, ci zadany test je HTML kodstatic booleanstatic booleansend(String fromName, String fromEmail, String toEmail, String subject, String text, String attachments) static booleansend(String fromName, String fromEmail, String toEmail, String ccEmail, String bccEmail, String subject, String text, String attachments) static booleansend(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList) static booleansend(String fromName, String fromEmail, String toEmail, String subject, String text, javax.servlet.http.HttpServletRequest request) sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList) sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList, boolean sendLaterWhenException) sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList, boolean sendLaterWhenException, boolean writeToAuditLog) Odoslanie emailusendCapturingException(MailHelper mailHelper) static booleansendLater(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String date, String time) static booleansendLater(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String date, String time, String attachments) Oneskorene odoslanie emailu
-
Field Details
-
AUTOREPLY_SUBJECT
Comment forAUTOREPLY_DAEMON- See Also:
-
EMAIL_PROTECTION_SENDER_KEY
- See Also:
-
EMAIL_PROTECTION_SENDER_NAME_KEY
- See Also:
-
-
Constructor Details
-
SendMail
public SendMail()
-
-
Method Details
-
send
-
send
-
send
-
send
-
send
-
sendCapturingException
-
sendCapturingException
-
sendCapturingException
public static Pair<Boolean,Exception> sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList, boolean sendLaterWhenException, boolean writeToAuditLog) Odoslanie emailu- Parameters:
senderName- - meno odosielatela emailusenderEmail- - email odosielatela emailurecipientEmail- - email prijemcureplyTo- - email pre pole replyTo, alebo nullsubject- - predmetmessage- - body emailu, moze byt v HTML formate, vratane odkazov na obrazky a linkybaseHref- - base HTTP adresa (aby bolo mozne nalinkovat obrazky a spravit relativne linky)attachmentsList- - zoznam priloh vo formate url_adresa1;nazov_suboru_do_emailu1;url_adresa2;nazov_suboru_do_emailu2;sendLaterWhenException- - ak je true, tak pri exception pri odosielani, ulozi e-mail pre neskorsie odoslaniewriteToAuditLog- - ak je false, tak sa posle len e-mail, ale nezapise sa nic do auditlogu- Returns:
- true, ak sa email podarilo odoslat, inak false
- Throws:
Exception
-
sendCapturingException
-
sendLater
-
sendLater
public static boolean sendLater(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String date, String time, String attachments) Oneskorene odoslanie emailu- Parameters:
senderName-senderEmail-recipientEmail-replyTo-subject-message-baseHref-date-time-- Returns:
-
getInlineAttachments
Ziska zoznam inline priloh (obrazkov)- Parameters:
htmlCode-- Returns:
-
isHtmlContent
Otestuje, ci zadany test je HTML kod- Parameters:
html-- Returns:
-
attFile
Description of the Method- Parameters:
serverPath- Description of the ParameterfileName- Description of the Parametermp- Description of the Parameter
-
getEncoding
Vrati kodovanie pre email podla nastavenia servera, alebo ak nie je prazdne podla konfiguracnej premennej emailEncoding- Returns:
-
createAbsolutePath
Vytvori absolutne cesty v zadanom HTML kode- Parameters:
htmlCode- - HTML kodbasePath- - absolutna adresa, bez koncoveho /, napr. http://www.iway.sk- Returns:
-
createAbsolutePath
-
getSession
- Parameters:
props-- Returns:
-
getFirstEmailAddress
Ziska prvu email adresu zo stringu typu meno@domena.sk,ine@domena.sk (pre polia, ktore mozu mat len jeden email ako from a replyTo)- Parameters:
email-- Returns:
-
getDefaultSenderName
Return senderName of various email from config value moduleDefaultSenderName or defaultSenderName if module version is not defined. If config value is not defined, fallback is empty then domain name will be used.- Parameters:
module-fallbackName- - if no defaultSenderName constants is defined this value will be used- Returns:
-
getDefaultSenderEmail
Return senderEmail of various email from config value moduleDefaultSenderEmail or defaultSenderEmail if module version is not defined. If config value is not defined, fallback is empty then domain name will be used.- Parameters:
module-fallbackEmail- - if no defaultSenderEmail constants is defined this value will be used- Returns:
-