commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henning P. Schmiedehausen" <...@intermeta.de>
Subject Re: Commons - email Help
Date Tue, 30 Aug 2005 12:28:06 GMT
Eric Pugh <epugh@upstate.com> writes:

It reacts on the SMTP dialog return codes. A local mail server is able
to resolve local user names:

% telnet mail.intermeta.de smtp
Trying 192.168.2.3...
Connected to mail.intermeta.de (192.168.2.3).
Escape character is '^]'.
220 mail.intermeta.de ESMTP Sendmail 8.12.11/8.12.11; Tue, 30 Aug 2005 14:23:21 +0200
HELO forge.intermeta.de
250 mail.intermeta.de Hello forge.intermeta.de [192.168.2.4], pleased to meet you
MAIL FROM:<hps@intermeta.de>
250 2.1.0 <hps@intermeta.de>... Sender ok
RCPT TO:<foo@intermeta.de>
550 5.1.1 <foo@intermeta.de>... User unknown
RCPT TO:<foo@nothere.org>
250 2.1.5 <foo@nothere.org>... Recipient ok (will queue)

Note that the server returns 550 for an unknown local user but 250 for
an unknown remote user (though the mail server for nothere.org will
probably reply with an error mail).

The only way without administrator intervention around this is setting
up a local proxy mail server (James e.g.) and sending through it. The
other way is to configure your mail server to accept all local user
names (trust me. You don't want this).

Yet better is, if the application is able to react on both kinds of
failures.

	Regards
		Henning (Recovering ISP Sysadmin)


>Humm...

>One thing is that commons-email is just a wrapper around the JavaMail  
>api's, in an attempt to make them easier to use.  commons-email  
>doesn't do anything specifically fancy, like precheck if an email  
>address works or not.

>I would suggest that you write a unit test doing the same thing, but  
>using JavaMail directly, just to validate it.  I'm guessing that the  
>send() to a local email address does some sort of resolution right  
>there, versus queueing it up..  Or, the response from the SMTP server  
>is immediate, versus just queuing it up...

>Eric

>On Aug 29, 2005, at 11:14 AM, Sravan Duggaraju wrote:

>> Hi, I recently started Using commons email
>> (commons-email-SNAPSHOT.jar) for  send mail functionality.I am facing
>> the following problems.
>>
>> 1)In the To  field if i enter a wrong address of other domain it will
>> still send the mail, later it will inform me with "mail delivery
>> failure"...this is good. But it is not happening if i send a mail to
>> wrong email with in the same domain; it is immediately throwing
>>
>> javax.mail.SendFailedException: Sending failed;
>>   nested exception is:
>>     javax.mail.SendFailedException: Invalid Addresses;
>>   nested exception is:
>>     javax.mail.SendFailedException:
>>   ... User unknown
>>
>> If I am not clear let me explain,
>>
>> if i send a mail to wrongEmail@otherCompany.com then it is not
>> throwing any exception, later I am getting a email saying "delivery
>> failed"
>>
>> but i send mail to wrongEmail@myCompany.com then it is throwing
>> runtime exception. and it is not sending to other correct address
>> too......How to avoid this?
>>
>>
>> 2)This is related to my question 1.
>> In To field i entered correctEmail@mycompany.com and in CC i entered
>> wrongEmail@myCompany.com still it is not sending to correct address
>> and throughing an exception.
>>
>>
>>     public static void sendMessage(String[] to,String[] cc, String  
>> from,
>> String subject, String content)
>>       throws Exception {
>>         SimpleEmail email = new SimpleEmail();
>>         email.setHostName("mailserver.mycompany.com");
>>         email.setDebug(true);
>>         Collection toRecipients = new ArrayList();
>>           Collection ccRecipients = new ArrayList();
>>           //Create collection of To addresses
>>           if(!SBIRUtils.isEmpty(to)){
>>
>>             for (int i = 0; i < to.length; i++)
>>             {
>>                 toRecipients.add(new InternetAddress(to[i], null));
>>             }
>>             email.setTo(toRecipients);
>>           }
>> //      Create collection of To addresses
>>           if(!SBIRUtils.isEmpty(cc)){
>>
>>             for (int i = 0; i < cc.length; i++)
>>             {
>>                 ccRecipients.add(new InternetAddress(cc[i], null));
>>             }
>>             email.setCc(ccRecipients);
>>           }
>>           email.setFrom(from,from);
>>         email.setSubject(subject);
>>         email.setMsg(content);
>>         email.send();
>>     }
>>
>> I apologize for the big mail.
>>
>> I appreciate for any help
>> San
>>
>> ---------------------------------------------------------------------
>> 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

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

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