使用配置文件中设置的账户发送邮件，发送给多人

@param tos 收件人列表
@param subject 标题
@param content 正文
@param isHtml 是否为HTML
@param files 附件列表
423813
public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) {
		send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files);
	}
1280081
public void setContent(final String content) {
        if (content != null)
            attrMixin.setAttribute(CONTENT, content);
        else
            attrMixin.removeAttribute(CONTENT);
    }
619757
public void resolveContentType(FileRequestContext context) {
    String contentType = lookupMimeType(context.file.getName());
    if(contentType != null) {
      context.contentType = contentType;
      if(contentType.equals("text/html")) {
        context.contentType += ";charset=UTF-8";
      }
    }
  }
597940
function syncContents(file, val) {
  switch (utils.typeOf(val)) {
    case 'buffer':
      file._contents = val;
      file._content = val.toString();
      break;
    case 'string':
      file._contents = new Buffer(val);
      file._content = val;
      break;
    case 'stream':
      file._contents = val;
      file._content = val;
      break;
    case 'undefined':
    case 'null':
    default: {
      file._contents = null;
      file._content = null;
      break;
    }
  }
}
879947
function isServerHtmlFileExt(filePath) {
        if (!filePath) {
            return false;
        }

        return (_serverHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
    }
1280412
public static void setContentTypeHeader(HttpResponse response, File file) {
		String mimeType = MimeTypes.getMimeTypeForFileName(file.getName());
		String mimeFinal = mimeType != null ? mimeType : MimeTypes.getDefaultMimeType();
		response.headers().set(CONTENT_TYPE, mimeFinal);
	}
530519
private void addJQueryFile(Content head, DocPath filePath) {
        HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT(
                pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath());
        head.addContent(jqyeryScriptFile);
    }
386567
public static HttpResponse fromObject(HttpHeaders headers, @Nullable Object content) {
        return fromObject(headers, content, HttpHeaders.EMPTY_HEADERS, defaultMapper);
    }
1277509
function write(src, contents) {
      if (contents) {
        var script = '<script type="module" crossorigin>' + contents + '</' +
            'script>';
        doc.write(
            goog.TRUSTED_TYPES_POLICY_ ?
                goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
                script);
      } else {
        var script = '<script type="module" crossorigin src="' + src + '"></' +
            'script>';
        doc.write(
            goog.TRUSTED_TYPES_POLICY_ ?
                goog.TRUSTED_TYPES_POLICY_.createHTML(script) :
                script);
      }
    }
877402
function (contents) {
                        files.forEach((file, i) => {
                            context.addFile({
                                path: file,
                                content: contents[i]
                            });
                        });

                        return context;
                    }
106359
public void stringToFile(String content, String filename) throws IOException {
        stringToOutputStream(content, new FileOutputStream(filename));
    }
1013611
public final void setContent(String content)
    {
        //clear non relevant flags
        this.contentBinary=null;
        this.contentParts=null;
        this.contentType=ContentType.STRING;

        this.contentString=content;
    }
1363183
@Override
    protected void initContent() {

        // save initialized instance of this class in request attribute for included sub-elements
        getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
        // get the default encoding
        String content = getParamContent();
        if (CmsStringUtil.isNotEmpty(content)) {
            // content already read, must be decoded
            setParamContent(decodeContent(content));
            return;
        } else {
            content = "";
        }

        try {
            // lock resource if autolock is enabled
            checkLock(getParamResource());
            CmsFile editFile = getCms().readFile(getParamResource(), CmsResourceFilter.ALL);
            content = CmsEncoder.createString(editFile.getContents(), getFileEncoding());
        } catch (CmsException e) {
            // reading of file contents failed, show error dialog
            try {
                showErrorPage(this, e);
            } catch (JspException exc) {
                // should usually never happen
                if (LOG.isInfoEnabled()) {
                    LOG.info(exc);
                }
            }
        }
        setParamContent(content);
    }
1081320
public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{
        Properties props = new Properties();
        props.put("mail.smtp.user", emailConfg.getUser());
        props.put("mail.smtp.host", emailConfg.getHost());
        props.put("mail.smtp.port", emailConfg.getPort());
        props.put("mail.smtp.starttls.enable","true");
        props.put("mail.smtp.debug", emailConfg.getDebug());
        props.put("mail.smtp.auth", emailConfg.getAuth());
        props.put("mail.smtp.ssl.trust", emailConfg.host);

        SMTPAuthenticator auth = new SMTPAuthenticator(emailConfg.getUser(), (String)secret.get(SecretConstants.EMAIL_PASSWORD));
        Session session = Session.getInstance(props, auth);

        MimeMessage message = new MimeMessage(session);

        message.setFrom(new InternetAddress(emailConfg.getUser()));
        message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
        message.setSubject(subject);

        // Create the message part
        BodyPart messageBodyPart = new MimeBodyPart();

        // Now set the actual message
        messageBodyPart.setText(content);

        // Create a multipar message
        Multipart multipart = new MimeMultipart();

        // Set text message part
        multipart.addBodyPart(messageBodyPart);

        // Part two is attachment
        messageBodyPart = new MimeBodyPart();
        DataSource source = new FileDataSource(filename);
        messageBodyPart.setDataHandler(new DataHandler(source));
        messageBodyPart.setFileName(filename);
        multipart.addBodyPart(messageBodyPart);

        // Send the complete message parts
        message.setContent(multipart);

        // Send message
        Transport.send(message);
        if(logger.isInfoEnabled()) logger.info("An email has been sent to " + to + " with subject " + subject);
    }
227273
public void reportHTML(final Path target) throws IOException {
        
        Files.createDirectories(target.toAbsolutePath().getParent());
        
        LOGGER.info(() -> "Preparing HTML Report '" + title + "' to path: " + target);
        
        String html = UUtils.readResource("net/tuis/ubench/scale/UScale.html");
        Map<String, String> subs = new HashMap<>();
        subs.put("DATA", toJSONString());
        
        subs.put("TITLE", title);
        for (Map.Entry<String, String> me : subs.entrySet()) {
            html = html.replaceAll(Pattern.quote("${" + me.getKey() + "}"), Matcher.quoteReplacement(me.getValue()));
        }
        Files.write(target, html.getBytes(StandardCharsets.UTF_8));
        LOGGER.info(() -> "Completed HTML Report '" + title + "' to path: " + target);
    }
521917
@BindingAdapter("bind:tv_html")
    public static void setCustomHtml(TypefaceTextView textView, Boolean isHtml) {
        isHtml = isHtml != null ? isHtml : false;
        textView.mHtmlEnabled = isHtml;
        textView.setText(textView.getText());
    }
429619
@Override
	protected File writeFileContent( String fileContent ) throws IOException {

		// Load the template
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		InputStream in = getClass().getResourceAsStream( "/html.tpl" );
		Utils.copyStreamSafely( in, out );

		// Create the target directory
		File targetFile = new File( this.outputDirectory, "index.html" );
		Utils.createDirectory( targetFile.getParentFile());

		// Deal with the CSS file
		final String css;
		final String cssReference = this.options.get( DocConstants.OPTION_HTML_CSS_REFERENCE );
		if( cssReference != null ) {
			css = cssReference.trim();

		} else {
			css = "style.css";
			writeCssFile();
		}

		// Write sections
		for( Map.Entry<String,StringBuilder> entry : this.sectionNameToContent.entrySet()) {

			int index = entry.getKey().lastIndexOf( '/' );
			String title = entry.getKey().substring( index + 1 );
			String toWrite = out.toString( "UTF-8" )
					.replace( TITLE_MARKUP, title )
					.replace( CONTENT_MARKUP, entry.getValue().toString())
					.replace( MENU_MARKUP, this.menu )
					.replace( "href=\"", "href=\"../" )
					.replace( "src=\"", "src=\"../" )
					.replaceAll( "\n{3,}", "\n\n" );

			if( cssReference != null )
				toWrite = toWrite.replace( "../" + CSS_MARKUP, css );
			else
				toWrite = toWrite.replace( CSS_MARKUP, css );

			File sectionFile = new File( this.outputDirectory, entry.getKey() + ".html" );
			Utils.createDirectory( sectionFile.getParentFile());
			Utils.writeStringInto( toWrite, sectionFile );
		}

		// Write the main file
		String toWrite = out.toString( "UTF-8" )
				.replace( TITLE_MARKUP, this.applicationTemplate.getName())
				.replace( CSS_MARKUP, css )
				.replace( CONTENT_MARKUP, fileContent )
				.replace( MENU_MARKUP, this.menu )
				.replaceAll( "\n{3,}", "\n\n" );

		Utils.writeStringInto( toWrite, targetFile );

		// And the header image
		String imagePath = this.options.get( DocConstants.OPTION_HTML_HEADER_IMAGE_FILE );
		try {
			File sourceFile = null;
			if( imagePath != null )
				sourceFile = new File( imagePath );

			if( sourceFile != null && sourceFile.exists())
				in = new FileInputStream( sourceFile );
			else
				in = getClass().getResourceAsStream( "/roboconf.jpg" );

			File imgFile = new File( this.outputDirectory, "header.jpg" );
			Utils.copyStream( in, imgFile );

		} finally {
			Utils.closeQuietly( in );
		}

		return targetFile;
	}