hi, thnx for your kind help
btw, i did see a way to find if a certain host had any mail server or not.
tha would have been better i guess.
i already know ab8 the problems with sending and ICMP package :-s
On 11/2/06, Vincenzo Gianferrari Pini <[EMAIL PROTECTED]>
wrote:
Ahsan,
just for didactical purposes, the following should (?) be the minimum
code needed for your matcher (you need jdk 1.5):
--------------
package serveravailability.matcher;
import java.io.IOException;
import org.apache.mailet.GenericRecipientMatcher;
import org.apache.mailet.MailAddress;
import java.net.InetAddress;
public class SAMatcher2 extends GenericRecipientMatcher {
public boolean matchRecipient(MailAddress recipient) {
try {
InetAddress address =
InetAddress.getByName(recipient.getHost());
if (address.isReachable(30000)) {
return false;
} else {
return true;
}
} catch (IOException ex) {
return true;
}
}
}
--------------------
As you see, it extends GenericRecipientMatcher, not GenericMatcher, so
it will work independently for multiple recipients.
I haven't tested it (and won't test it). Just compiled.
You don't need the mailet. use Bounce as I told you.
Anyway, it does not make sense to ping the domain name of a recipient's
address, as it would work only if it resolves to the ip of the mail
server specified in an MX record of the domain itself, and this
situation may be common only for small domains. Moreover, it is not sure
that an existing and running mail server does answer to a ping.
Read what Stefano wrote you some days ago.
Good luck with your assignment.
Vincenzo
Ahsan wrote:
>
> Dear Vicenzo,
> sure I can, thnaks for your help :)
>
> -
> ahsan
>
> On 11/2/06, *Vincenzo Gianferrari Pini*
> <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Your attached files didn't go through (at least to me). Can you
> resend them?
>
> Vincenzo
>
> Ahsan wrote:
> > pls find attached my matcher and mailet files, thnaks for your
help.
> >
> > i am trying out your suggestion now and will let you know the
> results :)
> >
> > thanks again
> >
> > -
> > ahsan
> >
> >
> > On 11/1/06, *Vincenzo Gianferrari Pini*
> > <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>> wrote:
> >
> > If you don't need to pass any parameter to the matcher,
> simply writing
> > match="SAMatcher2" is ok.
> >
> > If it doesn't work the problem is inside your matcher code.
> Without
> > seeing it nobody can help you.
> >
> > Moreover, you don't need to write a specific mailet
> (SAMailet2) to
> > just
> > bounce back a message to the sender. Use instead the
> supplied Bounce
> > mailet and write:
> >
> > <mailet match="SAMatcher2" class="Bounce">
> > <sender>[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]
>></sender>
> > <message> Sorry, the email address you sent the
mail
> > to, is
> > not valid. Please have a look again. Thanks. </message>
> > <passThrough> false</passThrough>
> > </mailet>
> >
> > Hope it helps.
> >
> > Vincenzo
> >
> >
> > Ahsan wrote:
> > > these config.xml lines also do not work
> > >
> > > <mailet match="SAMatcher2" class="SAMailet2">
> > > <from>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>></from>
> > > <subject>mail delivery error !</subject>
> > > <content>Sorry, the email address u sent the mail to, is
> not valid.
> > > Please
> > > have a look again. Thanks.</content>
> > > </mailet>
> > >
> > >
> > > On 11/1/06, Ahsan < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>
> wrote:
> > >>
> > >> about the mailet and matcher, what i have done is-->>
> > >>
> > >> 1) if the host is not available (
> > [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>) then
> > >> the
> > >> matcher will return the address
> > >> the mailet will set the mail state to ghost and send a
> mail to the
> > >> sender.
> > >>
> > >> 2) if the host is available, then the matcher will return
> null,
> > the
> > >> mailet
> > >> will do nothing and the next mailet/matcher will do their
> job
> > >>
> > >> thanks
> > >>
> > >> -
> > >> ahsan
> > >>
> > >>
> > >> On 11/1/06, Ahsan < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>
> wrote:
> > >> >
> > >> > i have created the following mailet and matcher files
> and the
> > edited
> > >> > config file lines are given below.
> > >> > my JAMES is no longer running, it crashes :(
> > >> >
> > >> >
> > >>
> >
>
******************************************************************************************************************
> >
> > >>
> > >> > <mailetpackages>
> > >> > <mailetpackage>
org.apache.james.transport.mailets
> > >> > </mailetpackage>
> > >> > <mailetpackage>serveravailability.mailet
> </mailetpackage>
> > >> > </mailetpackages>
> > >> > <matcherpackages>
> > >>
> > <matcherpackage>org.apache.james.transport.matchers
> > >> > </matcherpackage>
> > >> > <matcherpackage>
> serveravailability.matcher</matcherpackage>
> > >> > </matcherpackages>
> > >> >
> > >> > ----
> > >> >
> > >> > <mailet match="SAMatcher2=all" class="SAMailet2">
> > >> > <from>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> </from>
> > >> > <subject>mail delivery error !</subject>
> > >> > <content>Sorry, the email address u sent the mail to,
is
> > not valid.
> > >> > Please have a look again. Thanks.</content>
> > >> > </mailet>
> > >> >
> > >> >
> > >>
> >
>
******************************************************************************************************************
> >
> > >>
> > >> >
> > >> > i have got a deadline, can you please have a look and
> let me know
> > >> what i
> > >> > did wrong ??
> > >> >
> > >> >
> > >>
> > >>
> > >> --
> > >> Md. Ahsanur Rashid,
> > >>
> > >> Level-2, Term-1,
> > >> Department of Computer Science and Engineering (CSE),
> > >> Bangladesh University of Engineering & Technology (BUET),
> > >> Dhaka-1000, Bangladesh.
> > >> Tel - (+88) 01715621323, 01717769404
> > >>
> > >
> > >
> > >
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>
> >
> >
> >
> >
> > --
> > Md. Ahsanur Rashid,
> >
> > Level-2, Term-1,
> > Department of Computer Science and Engineering (CSE),
> > Bangladesh University of Engineering & Technology (BUET),
> > Dhaka-1000, Bangladesh.
> > Tel - (+88) 01715621323, 01717769404
> >
>
------------------------------------------------------------------------
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
>
>
>
> --
> Md. Ahsanur Rashid,
>
> Level-2, Term-1,
> Department of Computer Science and Engineering (CSE),
> Bangladesh University of Engineering & Technology (BUET),
> Dhaka-1000, Bangladesh.
> Tel - (+88) 01715621323, 01717769404
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Md. Ahsanur Rashid,
Level-2, Term-1,
Department of Computer Science and Engineering (CSE),
Bangladesh University of Engineering & Technology (BUET),
Dhaka-1000, Bangladesh.
Tel - (+88) 01715621323, 01717769404