Forum OpenACS Q&A: Failed to spam in html...

Posted by David Kuczek on
I just tried to send a spam with a body_html. It didn't really work,
because the mail that has been sent, didn't contain anything but the

When I checked the database, I saw that the html has been inserted
though. So nothing wrong with the insert into spam_history...

I think that the spam-deamon sent the empty body_plain and not the

Anyone very familiar with the spam module?

Posted by Henry Minsky on
I wrote the spam module. Haven't used it in a long time though ...

There is some annoying code that I think we should take out, which
tries to guess whether the user wants plain text or html email.
It uses a field in the users_preferences table. Perhaps you could
just cut that out and have an option to send everyone html email, regardless of their preference, rather than try to
maintain that table info properly.

Posted by David Kuczek on
Hello Henry,

After some really deep digging, I found out yesterday what you just said. The spam is trying to guess what kind of email every user might want to receive by parsing the email address.

I changed the code so that it doesn't check in the user preferences table, but checks which database column (body_plain, body_html, body_aol) is NOT empty and then sends the appropriate format to every user...

I just commented out the following lines:

212                      if { [empty_string_p $email_type] } {

213                      set email_type "text/plain"

214                      } elseif { [string compare $email_type "text/html"] == 0 && [empty_string_p $body_html] } {

215                      set email_type "text/plain"

216                      } elseif { [string compare $email_type "text/aol-html"] == 0 && [empty_string_p $body_aol] } {

217                      set email_type "text/plain"

218                      }

and replaced them with...

I will post this replacement, when I get off work 😊 and parallely post it as a patch, although it is not really a patch.

As I don't really like plain text email spams and love nicely layouted html spams instead this little change might be valueable for others that want to spam their users with little pictures etc.

If anybody has questions about nicely layouted email spams, don't hesitate to ask them on this thread...

Posted by David Kuczek on
Hamilton Chua asked me to post the patch for the spam module.

My patch basically turns off the option that you can insert three different versions of your spam (aol-html, html, plain text) into the spamimg interface, which then get sent to a user according to the guessed email preferences (see TABLE users_preferences - email_type), which are plain/text most of the time and thus the problem...

This is the way to the patch: