Thursday 15 August 2013

templating - Python preppy producing offensive leading blank line -



templating - Python preppy producing offensive leading blank line -

i'm trying utilize preppy template email messages, inserts leading blank line causes smtp treat message body in stead of headers. in standalone test i'm using next python code:

import preppy premsg = preppy.getmodule('email.prep') print "=========================================" print premsg.get("sender@example.com", "recipient@example,com", "message subject", "https://followthislink.com/qwertyuiopp") print "========================================="

and template stored in email.prep

{{def(preptoaddr, prepfromaddr, prepsubject, preplink)}} to: {{preptoaddr}} from: "{{prepfromaddr}} subject: {{prepsubject}} click link confirm email address: {{preplink}}

which when run looks this:

(email)tahaan@komputer:~/projects/email$ python prep1.py ========================================= to: sender@example.com from: "recipient@example,com subject: message subject click link confirm email address: https://followthislink.com/qwertyuiopp ========================================= (email)tahaan@komputer:~/projects/email$

should remove leading blank line , live it, or there should doing different output right?

to right need alter template eliminate eol @ end of {{def()}} ie

{{def(preptoaddr, prepfromaddr, prepsubject, preplink)}}to: {{preptoaddr}} from: "{{prepfromaddr}} subject: {{prepsubject}} click link confirm email address: {{preplink}}

to eliminate eol @ end need editor doesn't set eol in see eg vim no end of line on lastly line or eof

python templating smtplib

No comments:

Post a Comment