Connecting Mail
First of all, am I in the correct forum. The code is below, it may be way off the mark, but I think it's another problem:
at the bottom of the code, I put my e-mail address in the Address object. But the exception I get is:
Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 550 Invalid recipient: michael_heeneman@hotmail.com
is this a simple problem to resolve? I've been warned I may not have set the protocols up properly.
public void sendMessage() throws javax.mail.MessagingException
{
Properties properties = new Properties();
properties.setProperty("protocol","smtp");
properties.setProperty("type","transport");
properties.setProperty("class","com.sun.mail.smtp.SMTPTransport");
properties.setProperty("vendor","Sun Microsystems, Inc.");
Session session = Session.getInstance(properties);
SMTPMessage message = new SMTPMessage(session);
message.setEnvelopeFrom(fromAddress);
try
{
message.setHeader("There is a forum message for you.","There
is a forum message for you.");
}
catch (javax.mail.MessagingException me)
{
me.toString();
throw me;
}
message.setText("Your local group wants you to check at the
"+fromAddress);
int numberOfAddresses = 2;
InternetAddress[] addresses = new InternetAddress
[numberOfAddresses];
for (int i = 0; i<numberOfAddresses; i++)
addresses=new InternetAddress();
addresses[0].setAddress("michael_heeneman@hotmail.com");
addresses[1].setAddress("michael_heeneman@hotmail.com");
message.setRecipients(Message.RecipientType.TO,addresses);
URLName theURLName = new URLName(urlName);
SMTPTransport transport = new SMTPTransport(session,theURLName);
transport.send(message,addresses);
}>

