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:
def sample():
from gluon.contrib.pyfpdf import FPDF, HTMLMixin
class MyFPDF(FPDF, HTMLMixin):
def header(self):
self.set_font('Arial','',15)
def footer(self):
# Do Nothing
pdf=MyFPDF()
pdf.add_page()
pdf.cell(0,10, 'Text inside pdf, blah blah blah' ,0,1,'C')
# Here is where I get lost, the example I followed just made it so you could go to <localhost>.sample.pdf
# and view the pdf, which works fine but it's not what I want to do so I removed that code snippet
# I think I need to do something with the pdf to make it an attachable file and then attach it, so the rest would be
# Do something awesome to pdf to make it useful to mail
mail.send(to=['
sam...@abc.com'],
subject='An email with a pdf attached to it',
message='test',
attachments = ??? #Somehow attach my pdf?
On my test setup I can send emails fine, it's just making the pdf and adding it as an attachment I am stuck on. I am using GAE if that matters at all.
Thanks for the help!