i Am trying to add a string to thml content and out that i am getting is not as required
'str1' should be added in place of str1 to 'Attached is the report of your data - +str1'
str1= 'StringToBeAdded'
html_content1 = ''' Hi All,
<br>
<br>
Greetings from xyz!
<br>
Attached is the report of your data - + str1
<br>
<br>
Note: This is an automated email. In case of any queries, please reach us at
<br>
Regards,
<br>
abc '''
message = Mail(
from_email='from@example.com',
to_emails=to@example.com',
subject='Mail,
html_content=html_content1)
Expected Output
Attached is the report of your data - StringToBeAdded
Thanks in advance
You need to properly quote, see below such that str1 is treated as a variable , your post shows it within ''' such that it will not be interpreted as a variable merely as text.
str1= 'StringToBeAdded'
html_content1 = ''' Hi All,
<br>
<br>
Greetings from xyz!
<br>
Attached is the report of your data - ''' + str1 + '''
<br>
<br>
Note: This is an automated email. In case of any queries, please reach us at
<br>
Regards,
<br>
abc '''