I'm not sure what you mean in the second option, when you say filelike object what are you referring to? I tried:
... ... attachments = mail.Attachment(pdf, filename='sample.pdf')) where pdf=MyFPDF() from the original example, but that doesn't work. I'm sure this isn't a new issue, but I haven't been able to find any good information on what to do for this. I did look on web2pyslices.com. There are a few good examples of how to make a pdf and show it on a page, but I did not find any examples of how to attach the pdf to an email and send it. I did read the book but it only shows an example of attaching a file from a path, it doesn't cover what other arguments mail.Attachment can take or how else to use it. Since I am on GAE it seems that isn't an option so the book isn't helpful for this. I have searched this group but was not able to find a solution to the problem. Still looking for help on this. Thanks On Saturday, March 16, 2013 5:48:50 PM UTC-4, Alan Etkin wrote: > > I started looking at the MyFPDF examples and I am able to make simple >> pdf's. I want to be able to make a pdf and attach it to an >> > email. Here is a simple example to show what I am doing and where I get >> lost: >> > > If your app has write access to the filesystem (almost any environment has > except, i.e. GAE), I think you could solve this by writing the fpdf output > to an actual file (fpdf supports it, look at the project wiki), then pass > the new filepath to the attachment as described in the book: > http://www.web2py.com/books/default/chapter/29/08#Attachments > > One caveat I can think of is that for a given traffic/requests, you'll end > up with a lot of useless pdf data stored, so you could write some > additional background task for ereasing them. > > I suppose you could even leave the filelike object which receives the fpdf > output open and use that instead as attachment input without the need to > write to the filesystem. If you pass a file-like object as argument of > Attachment, you have to specify also the name of the file with > filename="filename.ext" (documented in the api) > > This is not a new issue. I think that you could find more useful stuff > with a search in this group or here: > > http://www.web2pyslices.com > > EDIT: sorry I did not read the GAE part of your message, so the second way > should be the appropiate. > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

