<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.6.2">
</HEAD>
<BODY>
Still get same error<BR>
<BR>
here is what shows up in jabber<BR>
<BR>
[01:40:20 PM] *** jabbermail is Online [forwarding email]<BR>
[01:40:20 PM] *** jabbermail is Offline<BR>
<BR>
Don't know if that helps<BR>
<BR>
On Thu, 2005-12-15 at 22:37 +0200, Norman Rasmussen wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">odd, with that error I wouldn't expect it to be sending the jabber messages.</FONT>
<FONT COLOR="#000000">try adding:</FONT>
<FONT COLOR="#000000"> my $jabmsg = Net::Jabber::Message->new();</FONT>
<FONT COLOR="#000000">just before:</FONT>
<FONT COLOR="#000000"> # Compose the message</FONT>
<FONT COLOR="#000000">On 12/15/05, Jon Scottorn <<A HREF="mailto:jscottorn@possibilityforge.com">jscottorn@possibilityforge.com</A>> wrote:</FONT>
<FONT COLOR="#000000">> Ok, disregard all my previous emails, I have got it sending to jabber now but there is something else wrong now that I have no clue how to fix. I send the message and it sends to my jabber client saying [forwarding message] and that's it. I also get a reply back in my email with this error.</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Can't call method "SetMessage" on an undefined value at smtp2jabber.pl line 42, <STDIN> line 1.</FONT>
<FONT COLOR="#000000">> 554 5.3.0 unknown mailer error 255</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Anyone know what that is.</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> I am sending my email message as plain text with no attachments.</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Thanks,</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Jon</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> On Thu, 2005-12-15 at 06:22 -0500, Bart Smit wrote:</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Assuming that on the jabber server your MTA is sendmail you can do this:</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Edit your sendmail.cf to listen for external connections:</FONT>
<FONT COLOR="#000000">> dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Set a catch all for the server or domain in /etc/mail/virtusertable:</FONT>
<FONT COLOR="#000000">> @your.jabber.org                mailerscript</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Add an alias for the script in /etc/aliases (don't forget to run</FONT>
<FONT COLOR="#000000">> newaliases as root):</FONT>
<FONT COLOR="#000000">> mailerscript        |smtp2jabber.pl</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Manually register a bot user on your jabber server and set the user/pass</FONT>
<FONT COLOR="#000000">> to mailer/password (if you use other credentials, edit the script</FONT>
<FONT COLOR="#000000">> accordingly).</FONT>
<FONT COLOR="#000000">> Save the attached script as smtp2jabber.pl and place it in /etc/smrsh or</FONT>
<FONT COLOR="#000000">> link it from there. Remember to chmod it to be world executable.</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Use cpan or your favourite package manager to install the perl modules</FONT>
<FONT COLOR="#000000">> at the top of the script. Restart sendmail and test.</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Bart...</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> #!/usr/bin/perl</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> use strict;</FONT>
<FONT COLOR="#000000">> use Mail::Message;</FONT>
<FONT COLOR="#000000">> use Mail::Message::Field;</FONT>
<FONT COLOR="#000000">> use Mail::Message::Construct::Read;</FONT>
<FONT COLOR="#000000">> use Mail::Message::Attachment::Stripper;</FONT>
<FONT COLOR="#000000">> use Mail::Message::Body;</FONT>
<FONT COLOR="#000000">> use Net::Jabber;</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> use constant SERVER => "your.jabber.org";</FONT>
<FONT COLOR="#000000">> use constant PORT => 5222;</FONT>
<FONT COLOR="#000000">> use constant USERNAME => "mailer";</FONT>
<FONT COLOR="#000000">> use constant PASSWORD => "password";</FONT>
<FONT COLOR="#000000">> use constant RESOURCE => "Perl Script";</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # The email message come in on STDIN</FONT>
<FONT COLOR="#000000">> my $msg = Mail::Message->read(\*STDIN);</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Pick out the recipient, subject and sender</FONT>
<FONT COLOR="#000000">> my $rcpt = $msg->head->get('to');</FONT>
<FONT COLOR="#000000">> my $subject = $msg->head->get('subject');</FONT>
<FONT COLOR="#000000">> my $sender = $msg->head->get('from');</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Remove the angle brackets</FONT>
<FONT COLOR="#000000">> $rcpt =~ s/^<//;</FONT>
<FONT COLOR="#000000">> $rcpt =~ s/>$//;</FONT>
<FONT COLOR="#000000">> $sender =~ s/^<//;</FONT>
<FONT COLOR="#000000">> $sender =~ s/>$//;</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Remove the attachment(s) from the message</FONT>
<FONT COLOR="#000000">> my $stripper = Mail::Message::Attachment::Stripper->new($msg);</FONT>
<FONT COLOR="#000000">> my Mail::Message $textonly = $stripper->message;</FONT>
<FONT COLOR="#000000">> my $body = $textonly->body;</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Connect to jabber</FONT>
<FONT COLOR="#000000">> my $jabber = &setup_Jabber(SERVER, PORT, USERNAME, PASSWORD, RESOURCE,</FONT>
<FONT COLOR="#000000">> "normal/forwarding email");</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Compose the message</FONT>
<FONT COLOR="#000000">> my $jabmsg->SetMessage(</FONT>
<FONT COLOR="#000000">> "to" => "$rcpt",</FONT>
<FONT COLOR="#000000">> "subject" => "$sender emailed: $subject",</FONT>
<FONT COLOR="#000000">> "body" => "$body");</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # And send it</FONT>
<FONT COLOR="#000000">> $jabber->Send($jabmsg);</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Close the connection and exit</FONT>
<FONT COLOR="#000000">> $jabber->Disconnect();</FONT>
<FONT COLOR="#000000">> exit(0);</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> sub setup_Jabber {</FONT>
<FONT COLOR="#000000">> my ($server, $port, $user, $pass, $resource, $initial_status) = @_;</FONT>
<FONT COLOR="#000000">> my $connection = new Net::Jabber::Client;</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Connect</FONT>
<FONT COLOR="#000000">> my $status = $connection->Connect( hostname => $server,</FONT>
<FONT COLOR="#000000">> port => $port );</FONT>
<FONT COLOR="#000000">> die "Cannot connect to Jabber server $server on port $port\n"</FONT>
<FONT COLOR="#000000">> unless $status;</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Callbacks</FONT>
<FONT COLOR="#000000">> $connection->SetCallBacks( presence => \&InPresence );</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Ident/Auth</FONT>
<FONT COLOR="#000000">> my @result = $connection->AuthSend( username => $user,</FONT>
<FONT COLOR="#000000">> password => $pass,</FONT>
<FONT COLOR="#000000">> resource => $resource );</FONT>
<FONT COLOR="#000000">> die "Ident/Auth failed: $result[0] - $result[1]\n"</FONT>
<FONT COLOR="#000000">> if $result[0] ne "ok";</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Roster</FONT>
<FONT COLOR="#000000">> $connection->RosterGet();</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> # Set initial presence</FONT>
<FONT COLOR="#000000">> &set_presence($connection, $initial_status);</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> return $connection;</FONT>
<FONT COLOR="#000000">> }</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> sub InPresence</FONT>
<FONT COLOR="#000000">> {</FONT>
<FONT COLOR="#000000">> my $presence = $_[1];</FONT>
<FONT COLOR="#000000">> my $type = $presence->GetType();</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> if ($type eq "subscribe") {</FONT>
<FONT COLOR="#000000">> $jabber->Send($presence->Reply(type => 'subscribed'));</FONT>
<FONT COLOR="#000000">> }</FONT>
<FONT COLOR="#000000">> elsif ($type eq "unsubscribe") {</FONT>
<FONT COLOR="#000000">> $jabber->Send($presence->Reply(type => 'unsubscribed'));</FONT>
<FONT COLOR="#000000">> }</FONT>
<FONT COLOR="#000000">> }</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> sub set_presence {</FONT>
<FONT COLOR="#000000">> my ($connection, $s) = @_;</FONT>
<FONT COLOR="#000000">> my $presence = Net::Jabber::Presence->new();</FONT>
<FONT COLOR="#000000">> my ($show, $status) = split("/", $s, 2);</FONT>
<FONT COLOR="#000000">> $presence->SetPresence( show => $show,</FONT>
<FONT COLOR="#000000">> status => $status );</FONT>
<FONT COLOR="#000000">> $connection->Send($presence);</FONT>
<FONT COLOR="#000000">> }</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> -----Original Message-----</FONT>
<FONT COLOR="#000000">> From: <A HREF="mailto:jdev-bounces@jabber.org">jdev-bounces@jabber.org</A> [mailto:<A HREF="mailto:jdev-bounces@jabber.org">jdev-bounces@jabber.org</A>] On Behalf</FONT>
<FONT COLOR="#000000">> Of Peter Saint-Andre</FONT>
<FONT COLOR="#000000">> Sent: 14 December 2005 23:53</FONT>
<FONT COLOR="#000000">> To: Jabber software development list</FONT>
<FONT COLOR="#000000">> Subject: Re: [jdev] jabberSMTP</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Jon Scottorn wrote:</FONT>
<FONT COLOR="#000000">> > Hi all,</FONT>
<FONT COLOR="#000000">> ></FONT>
<FONT COLOR="#000000">> > I have been trying to locate a jabber smtp transport, does anyone</FONT>
<FONT COLOR="#000000">> > know of any such thing. I basically need something that will parse an</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> > email sent to say <A HREF="mailto:jonsmel@jabber.org">jonsmel@jabber.org</A> <mailto:<A HREF="mailto:jonsmel@jabber.org">jonsmel@jabber.org</A>> and</FONT>
<FONT COLOR="#000000">> > reformat it into a xmpp message and send it to the user. I don't</FONT>
<FONT COLOR="#000000">> > really care about attachments, it will only be text.</FONT>
<FONT COLOR="#000000">> ></FONT>
<FONT COLOR="#000000">> > Does anyone know of this type of item?</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> The old theoretic-smtp project did something like that, but it</FONT>
<FONT COLOR="#000000">> disappeared after the JabberStudio rootkit. I've sent the code to Jon on</FONT>
<FONT COLOR="#000000">> an as-is basis. If anyone else has code like this (more recent than</FONT>
<FONT COLOR="#000000">> theoretic-smtp), feel free to post to the list. :-)</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Peter</FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">> Jon Scottorn</FONT>
<FONT COLOR="#000000">> Systems Administrator</FONT>
<FONT COLOR="#000000">> The Possibility Forge, Inc.</FONT>
<FONT COLOR="#000000">> <A HREF="http://www.possibilityforge.com">http://www.possibilityforge.com</A></FONT>
<FONT COLOR="#000000">> 435.635.0591 x.1004</FONT>
<FONT COLOR="#000000">--</FONT>
<FONT COLOR="#000000">- Norman Rasmussen</FONT>
<FONT COLOR="#000000"> - Email: <A HREF="mailto:norman@rasmussen.co.za">norman@rasmussen.co.za</A></FONT>
<FONT COLOR="#000000"> - Home page: <A HREF="http://norman.rasmussen.co.za/">http://norman.rasmussen.co.za/</A></FONT>
</PRE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<B><I><FONT SIZE="4"><FONT COLOR="#000080">Jon Scottorn</FONT></FONT></I></B><BR>
<I><FONT COLOR="#000080">Systems Administrator</FONT></I><BR>
<I><FONT COLOR="#000080">The Possibility Forge, Inc.</FONT></I><BR>
<I><FONT COLOR="#000080">http://www.possibilityforge.com</FONT></I><BR>
<I><FONT COLOR="#000080">435.635.0591 x.1004</FONT></I>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>