Re: Mail::Audit and MovableType

Jeff Bisbee <[email protected]> Mon, 26 Apr 2004 16:07:23 -0400
Newsgroups gmane.comp.lang.perl.modules.mail-audit
Message-ID <20040426200723.GB30933@biz>
Casey,

I was just about to do something like this so I could photo blog with my
phone :)  Thanks!

BTW, wanted to share something I came up with for my filter (nothing new
but pretty handy)  Often times my wife needs to get copies of e-mails
that get sent to me (credit card e-mail alerts, netflix, e-bay auction
notices, etc)  Anyway I threw together this snippet to strip out images
(because yahoo marks e-mails as spam if the source images aren't for the
site where the e-mail originated from) and just creates a copy and sends
it on its way.  After looking at it again, it could be cut down a bit,
but it worked, I just left it :)

    our @forward_addresses = qw([email protected]);

    # resend($msg) is to copy any ebay/netflix/cingular emails to 
    # my wife Heather # Mail::Audit->resend didn't work because the 
    # headers did match the host it was sent from so it was marked as 
    # spam by yahoo also html src images didn't match the domain of 
    # where the mail originated from so I just stripped those out 
    if ($msg->to =~ /netflix/ || 
	$msg->to =~ /ebay/ || 
	$msg->to =~ /discover/ || 
	$msg->to =~ /cingular/) {
	resend($msg);
    }

    sub resend
    {
	my ($msg) = @_;
	my $from = $msg->from;
	$from =~ s/\<.+?\>//;
	$from =~ s/\"//g;
	my $body = join('',@{$msg->body});
	$body =~ s/\<img .*?src.+?\>//gis; # strip out images :D
	for my $address (@forward_addresses) {
	    my %mail = (
		To      => $address,
		From    => '"' . $from . '" <' . $msg->to . '>',
		Subject => $msg->subject,
		Message => $body,
	    );
	    # forward whatever headers you want
	    for my $header ('Mime Version', 'Content-Type') {
		if (my $value = $msg->get($header)) {
		    $mail{$header} = $value;
		}
	    }
	    sendmail(%mail);
	}
    }


* Casey West ([email protected]) wrote:
> It was Monday, April 26, 2004 when Bowen Dwelle took the soap box, saying:
> : I've been using Mail::Audit for at least a couple of years now, and I've 
> : had it integrated with Mail::SpamAssassin for quite a while. Just now, 
> : I've hooked in Net::Blogger so that I can post to my MovableType blog 
> : automatically via email (e.g. from a camera phone). Perhaps someone else 
> : has already done this?
> 
> http://caseywest.com/code/scripts/post-journal.pl
> 
> I use Verizon in the US, you may have to play with it to get your
> camera phone to work. I also syndicate to use Perl;, and this is how.
> 
> Enjoy!
> 
>   Casey West
> 
> -- 
> Shooting yourself in the foot with BASIC (interpreted) 
> You shoot yourself in the foot with a water pistol until your leg is
> waterlogged and rots off. 
> 
> 
> _______________________________________________
> mail-audit mailing list
> [email protected]
> http://lists.netthink.co.uk/listinfo/mail-audit
> 
> 


-- Jeff Bisbee / [email protected] / jbisbee.com