zj
2025-01-06 0e7b38c2b3af72ea2a7f8a2fcbaad4d78e2c1977
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.gear.common.utils.emailsq;
 
import com.gear.common.utils.email.Emailer;
import com.gear.common.utils.emailsq.service.ServiceLocator;
import com.gear.common.utils.emailsq.service.ServiceSoapStub;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
//思齐 email
public class SpreadEmail {
 
    static final String loginEmail = "18338827235@163.com";
    static final String password = "8B04F934-7996-4B13-B3E1-E386F8AB8318";
//    static final String form = "sax@mail.saxtrader.cc";
    static final String form = "galaxytrader02@gmail.com";
 
 
 
    private static final Logger lg = LoggerFactory.getLogger("errorFile");
 
    /**
     *
     * @param toUser 接收人
     * @param title 标题
     * @param code 验证码
     */
    public static void sendEmail(String toUser, String title, String code) {
        StringBuilder body = new StringBuilder();
        body.append("Please check the verification code:").append("\r\n");
        body.append(code).append("\r\n");
        body.append("Notice:").append("\r\n");
        body.append("The verification code will expire in 10 minutes. Please verify it as soon as possible!").append("\r\n");
        try {
            ServiceLocator locator = new ServiceLocator();
            ServiceSoapStub stub = (ServiceSoapStub)locator.getServiceSoap();
            String sendEmail = stub.send(loginEmail, password, form, "Galaxy Digital",
                    toUser, title, body.toString());
            lg.info("邮件发送 --- " + sendEmail);
        }catch (Exception e){
            lg.error("邮件发送失败 --- " + e.getMessage());
            e.printStackTrace();
        }
    }
}