Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3661494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:18:41+00:00 2026-05-19T01:18:41+00:00

I originally setup my site to use my local ISP to send email through

  • 0

I originally setup my site to use my local ISP to send email through my site. I would like to change this, and start sending email through my VPS. According to the online documentation (from my vps provider) I have “POP before SMTP authentication”. So then, I do not require authentication nor do I require a secure connection at this time.

I changed a few things in the code I used for sending email through my local ISP. Here’s what I have :

Transport t = null; 
   try {
    String Username = "mrsmith@mydomain.com";
    String Password = "somepassword";

        InternetAddress from = new InternetAddress("mrsmith@mydomain.com", "Bob Smith");                        

    Properties props = new Properties();                                    

   //commented out, since I don't want to use authentication
   //props.setProperty("mail.smtp.auth", "true");           

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

   String protocol = "smtp";             
   Session ssn = Session.getInstance(props, null);
   ssn.setDebug(true);  

 t = ssn.getTransport(protocol);    

Store s = ssn.getStore();
s.connect();

  t.connect(SMTP,Username,Password);

//Create the message
Message msg = new MimeMessage(ssn);
msg.setFrom(from);
msg.addRecipient(Message.RecipientType.TO, to);
msg.setSubject(subject);
msg.setContent(body, "text/html");

t.sendMessage(msg, msg.getAllRecipients());
t.close();
s.close();  

I contacted my vps provider and after following their instructions, in tweaking the code, I still get “Authentication Failed”. This after a successful connection has been made to the host on port 25.

Can someone point out what it is I’m missing here?

Editing to add additional information

After I added the store.connect(“mailhost”,Username,Password); statement to the code, I got further than ever before!

Here is some info that was printed to the tomcat prompt –

DEBUG : getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc.]
POP3: connecting to host "mydomain.com", port 110, isSSL false
server ready
OK User name accepted, password please
Password somepassword
OK Mailbox open, 0 messages

DEBUG: geProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smpt.SMTPTransport,Sun Microsystems, Inc.]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "mydomain.com", port 25, isSSL false 
220 mydomain.com ESMTP Sendmail 8.14.3/8.14.3; DEC 2010 29
DEBUG SMTP: connected to host "mydomain.com", port: 25
( a lot of additional debug information was here )
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
535 5.7.0 authentication failed
javax.mail.AuthenticationFailedException
  at javax.mail.Service.connect(Service.java:319)
  at javax.mail.Service.connect(Service.java:169)
... continues with more 'at's.

Do you see anything odd in this information? I don’t quite understand why the authentication failed while the Pop3 was authenticated with the same username and password.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:18:41+00:00Added an answer on May 19, 2026 at 1:18 am

    POP before SMTP authentication basically means you need to be able to prove that you can fetch your mail using POP3 (using proper authentication) before you will be allowed to send mail using SMTP (without authentication).

    Using the Java Mail API, you can do the authentication to the POP3 server like this :

    Store store = ssn.getStore("pop3");
    store.connect("mailhost", Username, Password);
    

    You should execute these calls prior to connecting to the SMTP server, so before connecting to the SMTP server (without username and password) like this

    t.connect();
    

    make sure you connect to the store first.

    In your snippet, you are still authenticating against the smtp as you are providing a username/password.

    Another option is to use Commons Email, that has built-in support for pop before smtp authentication. Check out the following method in http://commons.apache.org/email/apidocs/org/apache/commons/mail/Email.html

    email.setPopBeforeSMTP(true,popHost,popUsername,popPassword);
    

    Using commons email, there’s no need to do the pop plumbing in your code (connecting prior to sending).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been dealing with a legacy asp.net 2.0 web site that was originally setup
We use Google Ad Manager to serve ads. I would like to create a
I originally setup some conditions using CGRectIntersectsRect for some collision detection which worked fine.
Setup OSX 10.7.4, Eclipse, Pydev, Python 2.7, Tweepy-1.9 Hey, I was originally trying to
Originally posted on Server Fault , where it was suggested this question might better
I originally started this question in another thread, but that thread was sorta, kinda
I released an app and I've implemented a user-requested feature and would like to
I would like to create web application with admin/checkout sections being secured. Assuming I
I've setup a site using http://razor.servicestack.net/ . I've created several views and matching services
I've got my web forms site (4.0) setup with UrlRouting. My bread crumb appears

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.