Recipient address rejected: Access denied

Hi,

I'm using JavaMail for the first time.

My SMTP server has a user Id and password so im using

transport.connect("esmtp.unwired.com.au","name@unwired.com.au","password");

But when I send I get the following exception (i have change the email addres but the one I use is valid):-

Exception in thread "main" javax.mail.SendFailedException: Invalid Addresses;

nested exception is:

com.sun.mail.smtp.SMTPAddressFailedException: 554 <test@dummy.com>: Recipient address rejected: Access denied

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)

at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)

at mailtests.SimpleMail.main(SimpleMail.java:33)

Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 <test@dummy.com>: Recipient address rejected: Access denied

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1094)

... 2 more

My full simple code is:-

public static void main(String[] args) throws Exception{

Properties props = new Properties();

props.put("mail.transport.protocol", "smtp");

//props.put("mail.smtp.host", "esmtp.unwired.com.au");

Session mailSession = Session.getDefaultInstance(props, null);

Transport transport = mailSession.getTransport();

MimeMessage message = new MimeMessage(mailSession);

message.setSubject("Testing javamail plain");

message.setContent("This is a test", "text/plain");

message.addRecipient(Message.RecipientType.TO,

new InternetAddress("dummy@test.com"));

Address[] from = new Address[1];

from[0] = new InternetAddress("greatcompany@ibridge.com.au");

message.addFrom(from);

//transport.connect();

transport.connect("esmtp.unwired.com.au","name@unwired.com.au","password");

if (transport.isConnected()){

transport.sendMessage(message,

message.getRecipients(Message.RecipientType.TO));

} else {

System.out.println("HGERE");

}

transport.close();

}

Thanks for any help,

Stu

[2123 byte] By [StuDeva] at [2007-11-27 8:09:48]
# 1
You're not setting the mail.smtp.auth property. http://java.sun.com/products/javamail/FAQ.html#smtpauth
bshannona at 2007-7-12 19:53:05 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...