Ovi, Do you know the email address? If so, then use JNDI and do a NSLOOKUP for MX records on the domain name.
for example: if you want to send mail to [EMAIL PROTECTED], then do a nslookup for MX records on gmail.com. From the command prompt it is: nslookup -type=mx gmail.com This will return several MX servers. Loop through those using the lowest numbered priority first. You will need to do a search on how to do nslookups with JNDI. HTH On 8/25/06, Ovi Comes <[EMAIL PROTECTED]> wrote:
Thanks Marc but how can I determine a valid MX entry for each email I send? I don't think that's viable solution since I don't know the target subscribers a priori. -----Original Message----- From: Marc Farrow [mailto:[EMAIL PROTECTED] Sent: Friday, August 25, 2006 5:01 PM To: Tomcat Users List Subject: Re: javamail + tomcat I am sure you can use a Mail session in Tomcat and set it up the same way, but I am calling javamail directly. if I am sending to gmail.com. I would use this code.. Properties props = new Properties(); props.put("mail.smtp.host","gmail-smtp-in.l.google.com"); props.put("mail.smtp.localhost", "localhost"); Session s = Session.getInstance(props,null); s.setDebug(true); MimeMessage message = new MimeMessage(s); message.setSubject(getSubject()); message.setFrom(InternetAddress.parse("[EMAIL PROTECTED]")[0]); message.setRecipient(Message.RecipientType.TO,"[EMAIL PROTECTED]"); message.setText("this is a test message"); Transport.send(message); On 8/25/06, Propes, Barry L <[EMAIL PROTECTED]> wrote: > > I'll sure take that under advisement. > > Tomcat has an additional component for sending email? I don't think I ever > knew that. Where's it configured? In the server.xml file? > > -----Original Message----- > From: Marc Farrow [mailto:[EMAIL PROTECTED] > Sent: Friday, August 25, 2006 3:52 PM > To: Tomcat Users List; [EMAIL PROTECTED] > Subject: Re: javamail + tomcat > > > If you want to send email directly via Tomcat, you can bypass relaying. > Just set the "mail.smtp.host" attribute to a valid MX entry for the > receiving domain. > > > > On 8/25/06, Ovi Comes <[EMAIL PROTECTED]> wrote: > > > > That is interesting. The funny thing is that I could send email to any > > account inbox. That is, running the code standalone. I can't figure out > > how > > Tomcat would possibly alter my email so that it ends up in the spam box. > > Plus, the headers are identical! > > > > > > > > -----Original Message----- > > From: Propes, Barry L [mailto:[EMAIL PROTECTED] > > Sent: Friday, August 25, 2006 4:08 PM > > To: Tomcat Users List; [EMAIL PROTECTED] > > Subject: RE: javamail + tomcat > > > > most likely you have to get relaying approved. > > > > I've had a similar problem and had to jettison the idea of JavaMail for > > now, > > due to the relaying problem. > > > > I could send through my desktop and only my email address through my ISP > > would receive it, and then only in the Bulk Mail folder! > > > > Quite an aggravation, and I never found from anyone anywhere, short of > > seeing the administrator, how to solve this problem. > > > > Problem for me was twofold: > > 1) how I do get my ISP to let other email addresses approved? > > 2) getting an email admin here at work to approve this was like getting > > Iran > > to concede on every nuclear point the U.S. or U.N. wants to adopt! > > > > -----Original Message----- > > From: Ovi Comes [mailto:[EMAIL PROTECTED] > > Sent: Friday, August 25, 2006 3:04 PM > > To: users@tomcat.apache.org > > Subject: javamail + tomcat > > > > > > Hi, > > > > > > > > I need help with javamail in tomcat. Here is my issue: if send an email > to > > an yahoo account, from my junit class everything is ok. When I run the > > same > > code in Tomcat, on the same machine, my email goes to spam/bulk folder. > > What > > is going on? > > > > > > > > Thanks, > > > > Ovi > > > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Free Edition. > > Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: > 8/24/2006 > > > > > > --------------------------------------------------------------------- > > To start a new topic, e-mail: users@tomcat.apache.org > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: > 8/24/2006 > > > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Free Edition. > > Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: > 8/24/2006 > > > > > > > > --------------------------------------------------------------------- > > To start a new topic, e-mail: users@tomcat.apache.org > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Marc Farrow > -- Marc Farrow -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 8/24/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 8/24/2006 --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Marc Farrow