Chris,
I am using commons email and a class called SimpleEmail which is extended
and used.
I have set the host name and port number in the constructor of
EmailMessenger (extends SimpleEmail)
public EmailMessenger() {
super();
setHostName(emailConfig.getHostName().trim());
setSmtpPort(Integer.parseInt(emailConfig.getSmtpPort().trim()));
}
and have a send function ..
public void sendMessage(QuickMessage message) {
List<UserAccount> userAccounts = message.getRecipientAddresses();
List<UserAccount> senders = message.getSenderAddresses();
if (null == userAccounts)
return;
for (int i = 0; i < userAccounts.size(); i++) {
UserAccount recipient = userAccounts.get(i);
try {
addTo(recipient.getUserEmail(), recipient.getUserFirstName()
+ " " + recipient.getUserLastName());
} catch (Exception e) {
LOGGER.error("Failed to add recipient ", e);
}
}
if (null != senders && senders.size() > 0) {
UserAccount sender = (UserAccount) senders.get(0);
try {
setFrom(sender.getUserEmail(), sender.getUserFirstName() + "
"
+ sender.getUserLastName());
} catch (EmailException e) {
LOGGER.error("Failed to send Sender", e);
}
}
this.setSubject(message.getSubject());
try {
LOGGER.debug(message.getMessage());
this.setMsg(message.getMessage());
} catch (EmailException e) {
LOGGER.error("Failed to send recipient", e);
}
try {
this.send();
} catch (EmailException e) {
LOGGER.error("Failed to send recipient", e);
}
}
Here host name is localhost and portnumber is 25.
On 10/4/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Arun,
>
> Arun wrote:
> > I have configured sendmail at port 25 in ubuntu. It is working correctly
> as
> > I checked sending mails using a perl script as well as a javaprogram,
> but my
> > web application running in tomcat does not allow me to send a mail. It
> > simply does not give me any error at all. But it does not send the mail
> at
> > the same time. Is there a tomcat configuration that I need to tweak.? i
> m
> > usin tomcat 6.
>
> As Tomcat doesn't have any built-in email sending abilities, we'd have
> to see the code you are using to attempt to send an email.
>
> No email message + no log messages/errors usually = you aren't actually
> trying to send the message. :(
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHBQ8d9CaO5/Lv0PARAk1zAJ4+5g5V9jC7AOLiqk3XpBcSztLqtACfchjN
> aUPGuv30RkIzp3NNQZcuOyQ=
> =Xe+u
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [email protected]
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Thanks
Arun George