email.setFrom(from); email.setTo(receivers); email.setSubject(subject);
email.setFrom(from); email.setTo(receivers); email.setSubject(subject);
mail.setFrom(from);
mail.setFrom(from);
/** * Default constructor of a CmsSimpleMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsSimpleMail() { // 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); } }
theMail.setCharset(getCmsObject().getRequestContext().getEncoding()); if (CmsStringUtil.isNotEmpty(getFormConfiguration().getMailFrom())) { theMail.setFrom(getFormConfiguration().getMailFrom());
/** * Sends the given message to the given addresses.<p> * * @param cms the cms context * * @throws Exception if something goes wrong */ public void sendEmail(CmsObject cms) throws Exception { // create a plain text email CmsSimpleMail theMail = new CmsSimpleMail(); theMail.setCharset(cms.getRequestContext().getEncoding()); theMail.setFrom(cms.getRequestContext().getCurrentUser().getEmail(), getFrom()); theMail.setTo(createInternetAddresses(getTo())); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getCc())) { theMail.setCc(createInternetAddresses(getCc())); } theMail.setSubject("[" + OpenCms.getSystemInfo().getServerName() + "] " + getSubject()); theMail.setMsg(getMsg()); // send the mail theMail.send(); }
theMail.setCharset(getCmsObject().getRequestContext().getEncoding()); if (CmsStringUtil.isNotEmpty(getFormConfiguration().getMailFrom())) { theMail.setFrom(getFormConfiguration().getMailFrom());