Page 1 of 1

Mail Plugin - signature incomplete

Posted: Mon Dec 13, 2004 4:20 pm
by Guest
Hello,
the mail plugin which sends out blog entries generates it's own advertising sig for s9y, which I thin is fine.

Unfortunately, it is incomplete. It looks like this in my installation:


Das allerbeste Blog, Sie können es auch nutzen.
Wie das geht, sehen Sie auf .

Obviously, an URL is missing.

Regards,
Harald

Posted: Wed Dec 22, 2004 12:23 pm
by Guest
Looking at the issue further, this is because of HTML Stripping on emails. The important link to www.s9y.org is missing now. Would it be possible to enhance the HTML stripping code to keep the link text?

Posted: Wed Dec 22, 2004 12:32 pm
by garvinhicking
Thanks for looking into this. Indeed it can be solved easily by patching your plugins/serendipity_event_mailer/serendipity_event_mailer.php file.

Change this code:

Code: Select all

                    $mail = array(
                      'to'      => $this->get_config('mailto'),
                      'subject' => '[' . $serendipity['blogTitle'] . '] ' . $eventData['title'],
                      'body'    => $eventData['body'] . $eventData['extended'] . $serendipity['signature'],
                      'from'    => $serendipity['blogTitle'] . ' - ' . $eventData['author'] . ' <' . $serendipity['serendipityEmail'] . '>'
                    );

                    if($this->get_config('includelink') == true) {
                       $mail['body'] = serendipity_archiveURL($eventData['id'], $eventData['title']) . "\n\n" . $mail['body'];
                    }

                    if($this->get_config('striptags') == true) {
                       $mail['body'] = strip_tags($mail['body']);
                    }

                    mail($mail['to'], $mail['subject'], $mail['body'], "From: {$mail['from']}\r\n{$serendipity['mailheaders']}");
to this:

Code: Select all

                    $mail = array(
                      'to'      => $this->get_config('mailto'),
                      'subject' => '[' . $serendipity['blogTitle'] . '] ' . $eventData['title'],
                      'body'    => $eventData['body'] . $eventData['extended'],
                      'from'    => $serendipity['blogTitle'] . ' - ' . $eventData['author'] . ' <' . $serendipity['serendipityEmail'] . '>'
                    );

                    if (serendipity_db_bool($this->get_config('striptags', false)) == true) {
                       $mail['body'] = strip_tags($mail['body']) . $serendipity['signature'];
                    } else {
                        $mail['body'] .= $serendipity['signature'];
                    }

                    if (serendipity_db_bool($this->get_config('includelink', false)) == true) {
                       $mail['body'] = serendipity_archiveURL($eventData['id'], $eventData['title']) . "\n\n" . $mail['body'];
                    }

                    mail($mail['to'], $mail['subject'], $mail['body'], "From: {$mail['from']}\r\n{$serendipity['mailheaders']}");
Then it should work - please report back :)

Posted: Wed Dec 22, 2004 5:00 pm
by hollow
the corresponding blog is still on 0.7.1, so serendipity_bool is not used. If this is the only difference, I can modify Your code accordingly.

The diff is

Code: Select all


diff -U2 serendipity_event_mailer/serendipity_event_mailer.php new
--- serendipity_event_mailer/serendipity_event_mailer.php       2004-12-09 00:53:52.000000000 +0100
+++ new 2004-12-22 16:59:52.000000000 +0100
@@ -88,5 +88,5 @@
                       'to'      => $this->get_config('mailto'),
                       'subject' => '[' . $serendipity['blogTitle'] . '] ' . $eventData['title'],
-                      'body'    => $eventData['body'] . $eventData['extended'] . $serendipity['signature'],
+                      'body'    => $eventData['body'] . $eventData['extended'] ,
                       'from'    => $serendipity['blogTitle'] . ' - ' . $eventData['author'] . ' <' . $serendipity['serendipityEmail'] . '>'
                     );
@@ -97,5 +97,8 @@
 
                     if($this->get_config('striptags') == true) {
-                       $mail['body'] = strip_tags($mail['body']);
+                       /* $mail['body'] = strip_tags($mail['body']); */
+                       $mail['body'] = strip_tags($mail['body']) . $serendipity['signature'];
+                    } else {
+                        $mail['body'] .= $serendipity['signature']; 
                     }
 

Regards,
Harald

Posted: Wed Dec 22, 2004 6:13 pm
by garvinhicking
Yes, but you should use the serendipity_db_bool code as well. It also works with 0.7.1 and should've been in there in first place already.

The diff you posted should work still, though.

Regards,
Garvin.