How does one connect to SMTP server to send email? I'm getting "recipient address rejected: access denied" and I think its because I'm not specifying login ID and password. When I look in the JavaMail api documentation I see information about how to connect for the purposes of getting pop3 or imap email i.e.
I tried this code but it didn't work. For purposes of writing email how should I connect to the SMTP server with ID and password.
I looked at that documentation and coded up an attempt, but I'm getting an authentication error.
The "how to authenticate yourself" documentation is again tailored to connecting to pop3. My problem is that I need an authenticated connection to the SMTP server so that I can write email.
I'm writing a Java App to do this so I don't have (app server) logs to look at. I set the property you suggested (smtp auth true) and I started to get email written (instead of getting address rejected: access denied). Whats odd is that I am still getting
javax.mail.AuthenticationFailedException at javax.mail.Service.connect(Service.java:306) at javax.mail.Service.connect(Service.java:156) at javax.mail.Service.connect(Service.java:105) at qflexAlert.emailESBsupp(qflexAlert.java:57) at qflexAlert.main(qflexAlert.java:17)
but my email is still written out by the SMTP server. I don't understand this.
I am replying to this mail even though its been ages since last reply. The below code is tested and does work. Make sure that firewall allows the required ports through.
Best of luck Sanjay Mistry
Java Rules....<br />SCJP 1.4, SCJD 1.4, busy with SCJWCD, after that SCBCD...
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.