How to send an email with attachment

Showing 1-14 of 14 messages
How to send an email with attachment Chka 6/8/11 9:21 AM
Hi,

I am using net.liftweb.util.Mailer to send an email. I am just wondering how to send an email with attachment. Does anyone know?

Thanks,
Valery
Re: How to send an email with attachment Tyler Weir 6/8/11 9:54 AM
Mailer uses javax.mail

So any example regarding sending attachments you see using javax.mail will work with Mailer.

You'll just need to translate the java to scala.
Re: [Lift] Re: How to send an email with attachment Chka 6/8/11 12:09 PM
Much appreciate for help. Thanks

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To view this discussion on the web visit https://groups.google.com/d/msg/liftweb/-/YzltMkJfSTdfRWNK.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Regards,
Bayarmunkh
chi...@gmail.com

Cell Phone: 641/233-0537

This message has been hidden because it was flagged for abuse.
Re: [Lift] How to send an email with attachment Viktor Hedefalk 2/10/12 5:56 AM
I'm having problems with sending attachments from my app. I haven't been able to catch this problem until now when I have a lot of Microsoft-users receiving mail from my app 

There is a bug in some version of Exchange that causes my PDF attachments to not show [1]. It seems to also be a problem with iPhones using Google accounts… (they use the Exchange-protocol, no?) I found this blog entry about it [2].

The bug manifests itself simply by not showing any attachments in the mail. For Microsoft users I have been able to tell them to use the web interface (OWA) and since they see the attachment there they kind of realize it's their software that's causing the problem and get off my back. It's still bad though, and I would really like to fix it.

Has anybody had this problem? I would guess the BlackBerrys Naftoli mentions is probably the same thing?

Is there an alternative way to embed the attachments that circumvents this bug?

Any help is highly appreciated.


Re: [Lift] How to send an email with attachment Viktor Hedefalk 2/10/12 6:11 AM
I don't have the patience to read too much right now, but I got the feeling that "Content-disposition: inline" is the problem. Mailer.buildMailBody uses:

 rel_bpi.setDisposition("inline")

but put's them all in the end anyways. I'm gonna try to change it to

 rel_bpi.setDisposition("attachment")

and see what happens. I'll report back.

Thanks,
Viktor


--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Re: [Lift] How to send an email with attachment Viktor Hedefalk 2/10/12 6:49 AM
Nope, it didn't help using either "attachment" nor empty Content-Disposition…

Cheers,
Viktor
Re: [Lift] How to send an email with attachment Viktor Hedefalk 2/10/12 7:04 AM
Ok, I finally found it. It seems "multipart/related" in the surrounding Content-type that was causing my issues.

I simply changed to "mixed" instead which I understand is the default:
Mailer.buildMailBody:

val html_mp = new MimeMultipart("related")

->

val html_mp = new MimeMultipart("mixed")


and now my attachments show in iPhones. Oh yes!

Even inline attachments works now so I guess that Exchange bug wasn't really relevant.


Thanks,
Viktor
Re: [Lift] How to send an email with attachment fmpwizard 2/10/12 7:06 AM
Thanks for posting the solution!

  Diego

--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com

Re: [Lift] How to send an email with attachment Viktor Hedefalk 2/10/12 7:23 AM
It didn't seem to be just Exchange that had problems showing the PDF:s. I colleague with iPhone to Gmail over iMAP experienced the problem too…


Just a further thought:

I now understand why it's called XHTMLPlusImages. I guess "multipart/related" is typically used to send a complete web page with images that can be referred too by the html [1]. So I guess that was the original use case for this part of Mailer. And I guess "related" is needed in this case. Maybe original author (dpp?) can confirm…?

However, "related" seems to break MY use case for lots of clients, so maybe we should have either a way to control this by the user of Mailer or something more than PlusImageHolder to hold other attachments like PDF:s and some smart way of deciding what header to choose.




Thanks,
Viktor
Re: [Lift] How to send an email with attachment David Pollak 2/10/12 9:19 AM


On Fri, Feb 10, 2012 at 7:23 AM, Viktor Hedefalk <hede...@gmail.com> wrote:
It didn't seem to be just Exchange that had problems showing the PDF:s. I colleague with iPhone to Gmail over iMAP experienced the problem too…


Just a further thought:

I now understand why it's called XHTMLPlusImages. I guess "multipart/related" is typically used to send a complete web page with images that can be referred too by the html [1]. So I guess that was the original use case for this part of Mailer. And I guess "related" is needed in this case. Maybe original author (dpp?) can confirm…?


I don't remember why I did it that way. :-(
 
However, "related" seems to break MY use case for lots of clients, so maybe we should have either a way to control this by the user of Mailer or something more than PlusImageHolder to hold other attachments like PDF:s and some smart way of deciding what header to choose.

Can you open a ticket with some enhancements to Mailer so we can make it better?



--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net


Re: [Lift] How to send an email with attachment Viktor Hedefalk 2/10/12 11:36 AM
 
I don't remember why I did it that way. :-( 

:)

Can you open a ticket with some enhancements to Mailer so we can make it better?



Cheers,
Viktor

Re: [Lift] How to send an email with attachment Franz Bettag 2/12/12 9:55 AM
I used the native java stuff like this https://gist.github.com/1809910
Re: How to send an email with attachment Mike Limansky 1/23/13 1:02 AM
Hi all,

  I've prepared patch for Lift 2.5 to fix the MIME structure. It composes the mail the same way as gmail and outlook for the mail with both inline images and attachments (the only difference, that Lift doesn't add plain/text alternative part). It works for me, but it would be nice if someone else will test it.

The sample code for testing is available in this gist https://gist.github.com/4603352 (you should place correct email settings before running in the code). Or you can build Lift from my github repo fork: https://github.com/limansky/framework

--
Regards,
Mike.

среда, 8 июня 2011 г., 18:21:46 UTC+2 пользователь Chka написал: