aspose file tools
The moose likes Other Java Products and Servers and the fly likes Issue with my SMTP server setup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Issue with my SMTP server setup" Watch "Issue with my SMTP server setup" New topic

Issue with my SMTP server setup

shiva valanukonda

Joined: Sep 27, 2010
Posts: 25


I have configured the Default SMTP Virtual Server from my Administrative tools.
Which resulted as the with IP address ans i have given a port number as 25.
And the default IP address i can see is All Unassigned.
Authentication shows that Granted . like Access --> Relay --> granted for my IP.

But when i run my belo application, it gives me the following error.

Code :

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class SimpleSendEmail {
public static void main(String[] args) {

String host = "";
//please suggest , What would be the Host name
String to = "";
String from = "";
String subject = "My First Email";
String messageText = "I am sending a message using the"
+ " JavaMail API.\n"
+ "Here type your message.";
boolean sessionDebug = false;
Properties props = System.getProperties();
props.put("", host);
props.put("mail.transport.protocol", "smtp");
Session session = Session.getDefaultInstance(props, null);
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSentDate(new Date());
catch (MessagingException mex) {

Error :
com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 ny4sm10757043pbb.57

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(
at com.sun.mail.smtp.SMTPTransport.mailFrom(
at com.sun.mail.smtp.SMTPTransport.sendMessage(
at javax.mail.Transport.send0(
at javax.mail.Transport.send(
at SimpleSendEmail.main(

Please suggest , what would be the smtp host for my machine...


Marco Ehrentreich
best scout

Joined: Mar 07, 2007
Posts: 1283

Hi Shiva,

Google (and today probably any mail provider) doesn't allow you to use their SMTP server for sending mails without authenticating first. And that's what the error message tells you!

Have a look at this example on how to use authentication and GMail.

I agree. Here's the link:
subject: Issue with my SMTP server setup