commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Atlas" <MAt...@basistech.com>
Subject RE: Re: Email question..
Date Thu, 09 Feb 2006 20:15:21 GMT
The method .send() returns a String value after doing the actual mailing
action.

By assigning the return value of send() to a String variable, you can
inspect the return value of the method call after you called it.

Before, you were sending the message once, then sending the message
again and checking the return value on the second call to .send().

Imagine that the .send() method looks something like this inside:

public String send()
{
	Mailserver.send(msgBody); //mail goes out into internet
	return Mailserver.lastsentmessagestatus(); //result of this
method call gets returned in a string
}

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Frances
Sent: Thursday, February 09, 2006 1:50 PM
To: commons-user@jakarta.apache.org
Subject: Re: Email question..

Michael Atlas wrote:
> Try this:
> 
> String emailStatus = email.send();
> if(emailStatus.equals("")) throw new Exception ("Sending of message 
> failed.");

that did it..  thank you very much....:)
    (still don't get how you can call a method by just putting name of
method in a string... but I guess that's for another forum.......;)


> 
> 
> 
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Frances
> Sent: Thursday, February 09, 2006 1:16 PM
> To: commons-user@jakarta.apache.org
> Subject: Email question.. 
> 
> when send e-mail w/Jakarta Commons Email Package e-mail gets sent
> twice..  here's relevant code:
> 
> email.setHtmlMsg(msgBody);
> email.send();
> if (email.send().equals("")) throw new Exception ("Sending of message
> failed.");
> 
> only wait it gets sent only once is if I take out if(email....) line..

> why does this method return a string?  maybe I'm not doing the check
> right?  would appreciate suggestions.. thank you...
> 
> Frances
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message