I am creating the html for an email using a Python string, like so:
# Code setting up the message html
message = "long html message string"
scoped = ""
if settings.DEBUG:
scoped = "scoped"
header = """
<style %s type='text/css'>
@media only screen and (max-width: 480px){
.emailImage{
height:auto !important;
max-width:200px !important;
width: 100% !important;
}
}
</style>
""" % scoped
footer = "html message footer"
message = header + message + footer
# Code sending the message.
The problem is, the above code gives me the error ValueError: too many values to unpack. However, if I remove the scoped variable from the message, the html runs, i.e., this works (albeit without adding the scoped variable into my HTML as I want it to).
# Code setting up the message html
message = "long html message string"
header = """
<style type='text/css'>
@media only screen and (max-width: 480px){
.emailImage{
height:auto !important;
max-width:200px !important;
width: 100% !important;
}
}
</style>
"""
footer = "html message footer"
message = header + message + footer
# Code sending the message.
Why is the first version throwing that error, and how can I address the ValueError?