CmsHtmlMail theMail = new CmsHtmlMail(); theMail.setSubject(key("recommend.mail.subject.prefix") + getPageTitle()); theMail.setCharset(getRequestContext().getEncoding()); theMail.setHtmlMsg(getContent("recommend_mail.html", "html", getRequestContext().getLocale())); theMail.setTextMsg(getContent("recommend_mail.html", "text", getRequestContext().getLocale())); theMail.addTo(getEmailRecipient()); String sender = OpenCms.getSystemInfo().getMailSettings() .getMailFromDefault(); replyTo = sender; theMail.setFrom(sender); theMail.addReplyTo(replyTo); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getCopy())) { theMail.addCc(replyTo); theMail.send(); } catch (Exception e) { if (LOG.isWarnEnabled()) {
if ((htmlMsg.length() > 0) || !m_attachments.isEmpty()) { CmsHtmlMail htmlMail = new CmsHtmlMail(); htmlMail.setHtmlMsg(replaceMacros(htmlMsg.toString(), recipient)); Iterator<CmsResource> attachments = m_attachments.iterator(); while (attachments.hasNext()) { description = propertyTitle; htmlMail.attach(new CmsVfsDataSource(cms, resource), resource.getName(), description); htmlMail.setTextMsg(replaceMacros(txtMsg.toString(), recipient)); email = htmlMail; } else {
CmsHtmlMail mail = new CmsHtmlMail(); mail.setSubject(subject); for (String address : mailAddresses) { mail.addTo(address.trim()); template.setAttribute("users", lockedUsers); template.toString(); mail.setHtmlMsg(template.toString()); try { mail.send(); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e);
CmsHtmlMail theMail = new CmsHtmlMail(); theMail.setCharset(getCmsObject().getRequestContext().getEncoding()); if (CmsStringUtil.isNotEmpty(getFormConfiguration().getMailFrom())) { theMail.setFrom(getFormConfiguration().getMailFrom()); theMail.setTo(createInternetAddresses(getFormConfiguration().getMailTo())); theMail.setCc(createInternetAddresses(getFormConfiguration().getMailCC())); theMail.setBcc(createInternetAddresses(getFormConfiguration().getMailBCC())); theMail.setSubject(getFormConfiguration().getMailSubjectPrefix() + getFormConfiguration().getMailSubject()); theMail.setHtmlMsg(createMailTextFromFields(true, false)); theMail.setTextMsg(createMailTextFromFields(false, false)); String filename = attachment.getName().substring( attachment.getName().lastIndexOf(File.separator) + 1); theMail.attach( new CmsByteArrayDataSource( filename, theMail.send(); } else {
CmsHtmlMail theMail = new CmsHtmlMail(); theMail.setCharset(getCmsObject().getRequestContext().getEncoding()); if (CmsStringUtil.isNotEmpty(getFormConfiguration().getMailFrom())) { theMail.setFrom(getFormConfiguration().getMailFrom()); theMail.setTo(createInternetAddresses(mailTo)); theMail.setSubject(getFormConfiguration().getMailSubjectPrefix() + getFormConfiguration().getConfirmationMailSubject()); theMail.setHtmlMsg(createMailTextFromFields(true, true)); theMail.setTextMsg(createMailTextFromFields(false, true)); theMail.send(); } else {
/** * Default constructor of a CmsHtmlMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsHtmlMail() { // call super constructor super(); // set the host to the default mail host CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(); setHostName(host.getHostname()); this.setSmtpPort(host.getPort()); // check if username and password are provided String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { // authentication needed, set user name and password setAuthentication(userName, host.getPassword()); } try { // set default mail from address setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { // default email address is not valid, log error LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e); } }
super.send();
super.send();
CmsHtmlMail theMail = new CmsHtmlMail(); try { theMail.setSubject(key("letter.mail.subject.prefix") + getPageTitle()); theMail.setCharset(getRequestContext().getEncoding()); theMail.setHtmlMsg(getContent("letter_mail.html", "html", getRequestContext().getLocale())); theMail.setTextMsg(getContent("letter_mail.html", "text", getRequestContext().getLocale())); theMail.addTo(receiver); } finally { contactMail = sender; theMail.setFrom(sender); theMail.addReplyTo(contactMail); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getCopy())) { theMail.addCc(contactMail); theMail.send(); } catch (Exception e) { if (LOG.isWarnEnabled()) {
if ((htmlMsg.length() > 0) || !m_attachments.isEmpty()) { CmsHtmlMail htmlMail = new CmsHtmlMail(); htmlMail.setHtmlMsg(replaceMacros(htmlMsg.toString(), recipient)); Iterator attachments = m_attachments.iterator(); while (attachments.hasNext()) { description = propertyTitle; htmlMail.attach(new CmsVfsDataSource(cms, resource), resource.getName(), description); htmlMail.setTextMsg(replaceMacros(txtMsg.toString(), recipient)); email = htmlMail; } else {