Can you please enter this as an issue in JIRA?

http://issues.appfuse.org/browse/APF

Thanks,

Matt

On 10/8/07, L. <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I had troubles sending emails with attachement.
> That was using a remote SMTP server (from my internet provider) but there
> will be the same problems with a local SMTP server.
>
> From what I have gathered there are two flaws in MailEngine
> ( sendMessage(String[] emailAddresses, ClassPathResource resource, String
> bodyText, String subject, String attachmentName) )
>
>  - No from:
> There is no "helper.setFrom" call, so the from field uses sytem variables
> ([EMAIL PROTECTED]). Then the SMTP server from my internet provider refuses
> it because it's not a valid internet email address (on windows machine name
> are juste machine name not in the internet form).
>
>  - ClassPathResource attached file
> The file is read using ClassPathResource, but the file I want to send by
> email is not in the Class Path and I would expect that would be the case for
> quite a few developments.
>
>
> So I created a new sendMessage method defining a from address and an
> attachment as a File (see below) !
> Whether it is interesting enough to integrate into the latest AppFuse, it's
> up to you to decide.
>
>
> Cheers,
> [EMAIL PROTECTED]
> The Computing Froggy
>
>
> ===================== sendMessage =========
>      /**
>      * Convenience method for sending messages with attachments with a from
> source and File
>      *
>      * @param emailAddresses
>      * @param attachedFile
>      * @param bodyText
>      * @param subject
>      * @param attachmentName
>      * @throws MessagingException
>      * @author Ben Gill
>      */
>     public void sendMessage(String fromAdress, String[] emailAddresses,
>                             File attachedFile, String bodyText,
>                             String subject, String attachmentName)
>     throws MessagingException {
>         MimeMessage message =
>             ((JavaMailSenderImpl) mailSender).createMimeMessage();
>
>         // use the true flag to indicate you need a multipart message
>         MimeMessageHelper helper = new MimeMessageHelper(message, true);
>
>         helper.setTo(emailAddresses);
>         helper.setText(bodyText);
>         helper.setSubject(subject);
>         helper.setFrom(fromAdress);
>
>         helper.addAttachment(attachmentName, attachedFile);
>
>         ((JavaMailSenderImpl) mailSender).send(message);
>     }
> ================================
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/STMP-From-in-MailEngine-tf4588249s2369.html#a13096827
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to