Java mail problem

N

nialltimpson

The following gives off no error's but doesnt send the mail any idea's?

public void mailPass(){
try{
Properties props = new Properties();
props.put("mail.host","149.153.100.8");

Session mailConnection = Session.getInstance(props, null);
Message msg = new MimeMessage(mailConnection);

Address bill = new InternetAddress("(e-mail address removed)","Tech
Support");
Address customer = new InternetAddress("(e-mail address removed)");
System.err.println("setup mail");
msg.setContent("You Password For WWW.eScratchCard.ie is : ",
"text/plain");
msg.setFrom(bill);
msg.setRecipient(Message.RecipientType.TO,customer);
msg.setSubject("Your eScratchCards Passwrord");

Transport.send(msg);
}
catch(Exception e ){e.printStackTrace();}
}

I would appreceate any help, thanks Niall
 
A

Andy Flowers

nialltimpson said:
The following gives off no error's but doesnt send the mail any
idea's?

public void mailPass(){
try{
Properties props = new Properties();
props.put("mail.host","149.153.100.8");

Session mailConnection = Session.getInstance(props, null);
Message msg = new MimeMessage(mailConnection);

Address bill = new InternetAddress("(e-mail address removed)","Tech
Support");
Address customer = new InternetAddress("(e-mail address removed)");
System.err.println("setup mail");
msg.setContent("You Password For WWW.eScratchCard.ie is : ",
"text/plain");
msg.setFrom(bill);
msg.setRecipient(Message.RecipientType.TO,customer);
msg.setSubject("Your eScratchCards Passwrord");

Transport.send(msg);
}
catch(Exception e ){e.printStackTrace();}
}

I would appreceate any help, thanks Niall

What is the error ?
 
N

nialltimpson

It doesnt throw off an error, the mail message just isnt being sent!, that
what I cant get my head around
 
S

shakah

I think Javamail dumps verbose debug messages if you add a "mail.debug"
property set to "true" to the Properties used in call to
Session.getInstance(). You can probably do this by setting the property
on the command line or in the environment also, though I'm not sure.
 
N

nialltimpson

msg.saveChanges(); before your Transport.send(msg).

thank you very very much,
Have a very good night

Niall
 
I

Ike

Not sure you've gotten this working or note, but I had the same problem
regarding SENDING via JavaMail, until I finally set the mail.smtp.host
property with :

props.put("mail.smtp.host",...);

-Ike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,690
Latest member
MacGyver

Latest Threads

Top