Mail Plugin - signature incomplete

Found a bug? Tell us!!
Post Reply
Guest

Mail Plugin - signature incomplete

Post 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
Guest

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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 :)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hollow
Regular
Posts: 18
Joined: Mon Dec 20, 2004 11:16 pm

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply