I was trying to send an email using javaMail API using my own smtp server to gmail/hotmail/etc..I put the following code to specify smtp server's settings

Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host", "my smtp host");
props.put("mail.smtp.port", "my smtp host's port");

Session session = Session.getInstance(props,
          new javax.mail.Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password); //my smtp server's username and password
            }
          });

But when I run the program..I get the error saying cannot find domain in username or something like that.
I have the username like xyz@myDomain.com..could anyone please suggest it what the error is about?? ssl/tls is not required for this smtp server.
Thanks.

We will probably need something better than "or something like that", but my first guess would be to check the configuration of your local mail server. Can you send mail through it using an other mail tool?

i tried on a different computer..and it's working now, but it's in the junk folder..i don't know what went wrong on the other computer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.