Hi,

I have implemented my custom "SendConfirmationEMailProcessor.java" class. I 
have overriden the "internalProcess(Node formContentNode, Map<String, Object> 
parameters)" method to be able to add an attachment. Instead of calling 
sendMail(...) I have implemented a sendConfEmailWithAttachement(...) method as 
follows:

[code]private void sendConfEmailWithAttachement(String body, String from, 
String subject, String to, String contentType, Map<String, Object> parameters, 
File attachment) throws Exception {

    MgnlMailFactory mgnlMailFactory = MailModule.getInstance().getFactory();

    List<MailAttachment> attachments = MailUtil.createAttachmentList();
    
    attachments.add(new MailAttachment(attachment, "PDF EVENT TITLE", 
"description here", "attachment") );
    
    MgnlEmail email = mgnlMailFactory.getEmailFromType(parameters, 
"freemarker", contentType, attachments);
    email.setFrom(from);
    email.setSubject(subject);
    email.setToList(to);
    email.setBody(body);

    MailModule.getInstance().getHandler().sendMail(email);
}[/code]

It throws an error:

[code]2013-06-14 10:36:07,013 ERROR 
myPackage.Custom_SendConfirmationEMailProcessor: Contact email 
javax.mail.MessagingException: IOException while sending message;
  nested exception is:
        java.net.UnknownHostException: C
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:676)
        at javax.mail.Transport.send0(Transport.java:189)
        at javax.mail.Transport.send(Transport.java:118)
        at 
info.magnolia.module.mail.handlers.SimpleMailHandler.sendMail(SimpleMailHandler.java:64)
        at 
com.arvato.email.EM_SendConfirmationEMailProcessor.sendConfEmailWithAttachement
        ....

Caused by: java.net.UnknownHostException: C
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:525)
        at java.net.Socket.connect(Socket.java:475)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
        at sun.net.NetworkClient.openServer(NetworkClient.java:118)
        at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
        at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
        at 
sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
        at 
sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
        at java.net.URL.openStream(URL.java:1010)
        at javax.activation.URLDataSource.getInputStream(URLDataSource.java:92)
        at javax.activation.DataHandler.writeTo(DataHandler.java:290)
        at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1403)
        at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:874)
        at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:444)
        at 
com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:102)
        at 
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869)
        at javax.activation.DataHandler.writeTo(DataHandler.java:302)
        at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1403)
        at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1745)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:636)
        ... 120 more[/code]

Any idea why?

Thanks

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=4c4ccc94-bd1a-45c3-89a2-0e8bd158ba43


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to