@@ -0,0 +1,2780 @@
+package com.ctrip.zeus.service.mail.impl;%0A%0Aimport com.ctrip.zeus.exceptions.ValidationException;%0Aimport com.ctrip.zeus.service.mail.MailService;%0Aimport com.ctrip.zeus.service.mail.model.SlbMail;%0Aimport com.netflix.config.DynamicPropertyFactory;%0Aimport com.netflix.config.DynamicStringProperty;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.stereotype.Service;%0A%0Aimport javax.mail.*;%0Aimport javax.mail.internet.*;%0Aimport java.util.List;%0Aimport java.util.Properties;%0A%0A/**%0A * Created by fanqq on 2017/3/20.%0A */%0A@Service(%22defaultMailServiceImpl%22)%0Apublic class DefaultMailServiceImpl implements MailService %7B%0A    private final Logger log = LoggerFactory.getLogger(this.getClass());%0A%0A    private DynamicStringProperty host = DynamicPropertyFactory.getInstance().getStringProperty(%22mail.smtp.host%22, null);%0A    private DynamicStringProperty sender = DynamicPropertyFactory.getInstance().getStringProperty(%22mail.sender%22, null);%0A%0A    @Override%0A    public void sendEmail(SlbMail mail) throws Exception %7B%0A%0A        if (mail.getSubject() == null %7C%7C mail.getSubject().isEmpty()) %7B%0A            throw new IllegalArgumentException(%22Mail subject can not be blank!%22);%0A        %7D%0A%0A        if (mail.getRecipients() == null %7C%7C mail.getRecipients().size() == 0) %7B%0A            throw new IllegalArgumentException(%22Mail receivers can not be empty!%22);%0A        %7D%0A        if (host.get() == null %7C%7C sender.get() == null) %7B%0A            throw new ValidationException(%22Mail host and sender is not configured!%22);%0A        %7D%0A%0A        Properties properties = new Properties();%0A        properties.setProperty(%22mail.transport.protocol%22, %22smtp%22);%0A        properties.put(%22mail.smtp.host%22, host.get());%0A        properties.setProperty(%22mail.smtp.auth%22, %22false%22);%0A        properties.put(%22mail.smtp.socketFactory.fallback%22, %22true%22);%0A        Session session = Session.getInstance(properties);%0A        session.setDebug(false);%0A%0A        MimeMessage msg = new MimeMessage(session);%0A        msg.setFrom(new InternetAddress(%22%5C%22%22 + MimeUtility.encodeText(sender.get().split(%22@%22)%5B0%5D) + %22%5C%22%3C%22 + sender.get() + %22%3E%22));%0A        msg.setSubject(mail.getSubject());%0A        Multipart bodyMultipart = new MimeMultipart(%22related%22);%0A        msg.setContent(bodyMultipart);%0A        BodyPart htmlPart = new MimeBodyPart();%0A        htmlPart.setContent(mail.getBody(), %22text/html;charset=utf-8%22);%0A        bodyMultipart.addBodyPart(htmlPart);%0A        msg.saveChanges();%0A%0A        List%3CString%3E receivers = mail.getRecipients();%0A        Address%5B%5D tos = new InternetAddress%5Breceivers.size()%5D;%0A        for (int i = 0, j = receivers.size(); i %3C j; i++) %7B%0A            tos%5Bi%5D = new InternetAddress(receivers.get(i));%0A        %7D%0A        msg.setRecipients(Message.RecipientType.TO, tos);%0A        Transport.send(msg);%0A    %7D%0A%7D%0A

add DefaultMailServiceImpl