Daily Digest eMail - help with fixing code for proper message format

Started by SportPistol, March 04, 2012, 10:19:12 PM

Previous topic - Next topic

SportPistol

I posted this problem in the SMF 2.0 Support board and the question is still out there.  topic
Since this problem is code question, thought I would post it here. 
From the topic above, the Daily Digest code that was implemented generates an eMail with new topics; however, the URL Links and message are not properly formatted.
Here is an example:

The following topics have been started:
-----------------------------------------------
"<a href="hxxp://www.mywebsite.org/forums/index.php?topic=1513">Whats New Automatons - Admin Test Message II</a>" in "<a href="hxxp://www.mywebsite.org/forums/index.php?board=32">Sandbox</a>"

The code that generates this line in the eMail is:
$email['body'] .= "\n" . sprintf($langtxt[$lang]['topic_lines'], ('<a href="' . $scripturl . '?topic=' . $topic['id'] . '">' . $topic['subject'] . '</a>'), ('<a href="' . $scripturl . '?board=' . $board['id'] . '">' . $board['name'] . '</a>'));

What must be changed in this code to deliver a properly formatted message with active URL links?



IchBin™

I think what you have to do is to tell the sendmail function to send an HTML email. Nothing you have to do in the body section there. Look for the sendmail() function call after that code you have their, check to see if the parameter is set to true for sending an HTML email.
IchBin™        TinyPortal

SportPistol

Thank you.
Modified Sendmail() in ScheduledTasks.php to:
sendmail($email['email'], $email['subject'], $email['body'], null, null, true, 4);

Changing the format of the eMail message to HTML corrected the Absolute URL behavior.
Fixed one problem and created another.

eMail message is now a run on sentence.  the Line Feed (paragraph returns) are lost.
Any suggestions on where to correct the formatting of the message?

IchBin™

The formatting is in the code you posted. Simple add some line < br >'s to it where you need them.
IchBin™        TinyPortal

SportPistol

Thank you IchBin!
Problem is resolved and closed.
I updated the Daily Digest post at topic with the results.
The daily/weekly digest is now working and generating a properly formatted HTML eMail message.
Much Appreciated!

Advertisement: