Could not connect to SMTP host: mail.yahoo.com, port: 25

Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: mail.yahoo.com, port: 25

i was told that i can use yahoo.com to send email using jsp or is there any other smtpserver tt i can use to send my email? this is my code. thank in advance

package com.stardeveloper.bean.test;

import java.io.*;

import java.util.*;

import javax.mail.*;

import javax.mail.event.*;

import javax.mail.internet.*;

public final class MailerBean extends Object implements Serializable {

/* Bean Properties */

private String to = null;

private String from = null;

private String subject = null;

private String message = null;

public static Properties props = null;

public static Session session = null;

static {

/*Setting Properties for STMP host */

props = System.getProperties();

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

session = Session.getDefaultInstance(props, null);

}

/* Setter Methods */

public void setTo(String to) {

this.to = to;

}

public void setFrom(String from) {

this.from = from;

}

public void setSubject(String subject) {

this.subject = subject;

}

public void setMessage(String message) {

this.message = message;

}

/* Sends Email */

public void sendMail() throws Exception {

if(!this.everythingIsSet())

throw new Exception("Could not send email.");

try {

MimeMessage message = new MimeMessage(session);

message.setRecipient(Message.RecipientType.TO,

new InternetAddress(this.to));

message.setFrom(new InternetAddress(this.from));

message.setSubject(this.subject);

message.setText(this.message);

Transport.send(message);

} catch (MessagingException e) {

throw new Exception(e.getMessage());

}

}

/* Checks whether all properties have been set or not */

private boolean everythingIsSet() {

if((this.to == null) || (this.from == null) ||

(this.subject == null) || (this.message == null))

return false;

if((this.to.indexOf("@") == -1) ||

(this.to.indexOf(".") == -1))

return false;

if((this.from.indexOf("@") == -1) ||

(this.from.indexOf(".") == -1))

return false;

return true;

}

}

[2413 byte] By [pUnKzT3ra] at [2007-10-2 23:20:58]
# 1
the smtp server of yahoo needs authentication and i think is not free.. use gmail instead but it uses other smtp port and also has authentication.. another smtp is gawab mail
jgalacambraa at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
u have to add this lines:Properties props = session.getProperties(); props.put("mail.smtp.host", "smtp.mail.yahoo.com"); props.put("mail.smtp.auth","true");
golanblna at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
gmail.com? i try to put mail.gmail.com and mail.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&ltmpl=yj_wsad&ltmplcache=2 but both are unkown smtp
pUnKzT3ra at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
when i added those line, and i click send, the page just display null
pUnKzT3ra at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
try to check for the smtp server and pop server of gmail.com its has diffrent settings.. you cannot use the port 25 on gmail.com and it has authentication as i have said.. last option i can give is use gawab mail.
jgalacambraa at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
i have found this website: http://www.lifehacker.com/software/email-apps/how-to-use-gmail-as-your-smtp-server-111166.phpcan anyone teach me how can i apply what is in the website to my coding?
pUnKzT3ra at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
those sites are illegal to us so i cannot get pass through the firewll.. just read it
jgalacambraa at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
oh is illegal. sorry i didnt noe abt it
pUnKzT3ra at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
anyway heres a link that can guide you: http://www.javaworld.com/javaworld/jw-10-2001/jw-1026-javamail.html
jgalacambraa at 2007-7-14 15:58:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...