Examples of MailTransport


Examples of com.alibaba.citrus.service.mail.session.MailTransport

     * ȡ��ָ�����Ƶ�mail transport��
     */
    public MailTransport getMailTransport(String id, Properties overrideProps) throws MailTransportNotFoundException {
        id = assertNotNull(trimToNull(id), "no mailTransport id");

        MailTransport transport = mailTransports.get(id);

        if (transport == null) {
            throw new MailTransportNotFoundException("Could not find mail transport: " + id);
        }

        // ���ظ���
        return new MailTransport(transport, overrideProps);
    }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

        // set null
        mailService.setMailTransports(null);

        // reset transports
        Map<String, MailTransport> transports = createHashMap();
        transports.put("transport1", new MailTransport());
        transports.put("transport2", new MailTransport());
        mailService.setMailTransports(transports);

        assertNotNull(mailService.getMailTransport("transport1"));
        assertNotNull(mailService.getMailTransport("transport2"));

        transports = createHashMap();
        transports.put("transport3", new MailTransport());
        transports.put("transport4", new MailTransport());
        mailService.setMailTransports(transports);

        try {
            mailService.getMailTransport("transport1");
            fail();
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

    @Test
    public void getTransport() {
        MailServiceImpl mailService = new MailServiceImpl();

        Map<String, MailTransport> transports = createHashMap();
        transports.put("transport1", new MailTransport());
        mailService.setMailTransports(transports);

        // id is null
        try {
            mailService.getMailTransport((String) null);
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("no mailTransport id"));
        }

        // clone
        MailTransport transport = mailService.getMailTransport("transport1");

        assertNotNull(transport);
        assertNotSame(transport, mailService.getMailTransport("transport1"));
    }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

    public void getDefaultTransport() {
        MailServiceImpl mailService = new MailServiceImpl();

        // 1 transport
        Map<String, MailTransport> transports = createHashMap();
        transports.put("transport1", new MailTransport());
        mailService.setMailTransports(transports);

        assertNotNull(mailService.getMailTransport()); // the only transport is the default transport

        // 2 transports
        transports.put("transport2", new MailTransport());
        mailService.setMailTransports(transports);

        try {
            mailService.getMailTransport();
            fail();
        } catch (MailTransportNotFoundException e) {
            assertThat(e, exception("Could not find mail transport: _DEFAULT_"));
        }

        // with default transport
        MailTransport transport3 = new MailTransport();
        transport3.setDefault(true);
        transports.put("transport3", transport3);
        mailService.setMailTransports(transports);

        assertNotNull(mailService.getMailTransport());
        assertNotNull(mailService.getMailTransport("transport3"));

        // 2 default transports
        MailTransport transport4 = new MailTransport();
        transport4.setDefault(true);
        transports.put("transport4", transport4);

        try {
            mailService.setMailTransports(transports);
            fail();
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

        // set null
        mailService.setMailTransports(null);

        // reset transports
        Map<String, MailTransport> transports = createHashMap();
        transports.put("transport1", new MailTransport());
        transports.put("transport2", new MailTransport());
        mailService.setMailTransports(transports);

        assertNotNull(mailService.getMailTransport("transport1"));
        assertNotNull(mailService.getMailTransport("transport2"));

        transports = createHashMap();
        transports.put("transport3", new MailTransport());
        transports.put("transport4", new MailTransport());
        mailService.setMailTransports(transports);

        try {
            mailService.getMailTransport("transport1");
            fail();
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

    @Test
    public void getTransport() {
        MailServiceImpl mailService = new MailServiceImpl();

        Map<String, MailTransport> transports = createHashMap();
        transports.put("transport1", new MailTransport());
        mailService.setMailTransports(transports);

        // id is null
        try {
            mailService.getMailTransport((String) null);
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("no mailTransport id"));
        }

        // clone
        MailTransport transport = mailService.getMailTransport("transport1");

        assertNotNull(transport);
        assertNotSame(transport, mailService.getMailTransport("transport1"));
    }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

    public void getDefaultTransport() {
        MailServiceImpl mailService = new MailServiceImpl();

        // 1 transport
        Map<String, MailTransport> transports = createHashMap();
        transports.put("transport1", new MailTransport());
        mailService.setMailTransports(transports);

        assertNotNull(mailService.getMailTransport()); // the only transport is the default transport

        // 2 transports
        transports.put("transport2", new MailTransport());
        mailService.setMailTransports(transports);

        try {
            mailService.getMailTransport();
            fail();
        } catch (MailTransportNotFoundException e) {
            assertThat(e, exception("Could not find mail transport: _DEFAULT_"));
        }

        // with default transport
        MailTransport transport3 = new MailTransport();
        transport3.setDefault(true);
        transports.put("transport3", transport3);
        mailService.setMailTransports(transports);

        assertNotNull(mailService.getMailTransport());
        assertNotNull(mailService.getMailTransport("transport3"));

        // 2 default transports
        MailTransport transport4 = new MailTransport();
        transport4.setDefault(true);
        transports.put("transport4", transport4);

        try {
            mailService.setMailTransports(transports);
            fail();
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

    /** 取得指定名称的mail transport。 */
    public MailTransport getMailTransport(String id, Properties overrideProps) throws MailTransportNotFoundException {
        id = assertNotNull(trimToNull(id), "no mailTransport id");

        MailTransport transport = mailTransports.get(id);

        if (transport == null) {
            throw new MailTransportNotFoundException("Could not find mail transport: " + id);
        }

        // 返回复本
        return new MailTransport(transport, overrideProps);
    }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.session.MailTransport

     * ȡ��ָ�����Ƶ�mail transport��
     */
    public MailTransport getMailTransport(String id, Properties overrideProps) throws MailTransportNotFoundException {
        id = assertNotNull(trimToNull(id), "no mailTransport id");

        MailTransport transport = mailTransports.get(id);

        if (transport == null) {
            throw new MailTransportNotFoundException("Could not find mail transport: " + id);
        }

        // ���ظ���
        return new MailTransport(transport, overrideProps);
    }
View Full Code Here

Examples of com.blazebit.mail.MailTransport

    m.addEmbeddedImage("MyAvatar",
        new File("D:/Eigene Bilder/avatar1.jpg"), "image/jpeg");
    m.addAttachment("YourAvatar", new File("D:/Eigene Bilder/avatar.jpg"),
        "image/jpeg");

    MailTransport mt = MailTransport.SMTPS;
    mt.addTrustedHost("web118.ip-projects.de", true);
    mt.addTrustedHost("blazebit.com", true);

    new SimpleMailSender("smtp.blazebit.com", 465,
        "christian@blazebit.com", "aA159732684!", mt).sendMail(m);
    return "";
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.