Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5614 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

hello

sorry, my english is bad ...

I want to send an email without authentification, but without succes

I have configured IIS and SMTP

I use this code

import javax.mail.*;

import javax.mail.internet.*;

Properties props = new Properties();

props.setProperty("mail.smtp.host", smtpHost);

MimeMessage msg = new MimeMessage(Session.getDefaultInstance(props));

Multipart content = new MimeMultipart();

MimeBodyPart bodyPart = new MimeBodyPart();

bodyPart.setText(body);

content.addBodyPart(bodyPart);

msg.setContent(content);

msg.setSubject(subject);

msg.setFrom(new InternetAddress(from));

msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));

Transport.send(msg);

return true;

my parameters are ;)

- from :P [email protected]

- to : [email protected]

- subject : Test

- Body : MyTest

- smtpHost : 192.168.4.1

this smtpHost works with outlook

but Error :

java.net.UnkwonHostException: your_smtp_server.com

I forgot something ?

thanks

Posted

Looks like your smtpHost parameter is set to "your_smtp_server.com" replace the value for that parameter with the IP address.

Posted

I'm sorry but I don't understand your reponse.

I do what ;)

import javax.mail.*;

import javax.mail.internet.*;

Properties props = new Properties();

props.setProperty("mail.smtp.host", [color:orange]"192.168.4.1");

MimeMessage msg = new MimeMessage(Session.getDefaultInstance(props));

Multipart content = new MimeMultipart();

MimeBodyPart bodyPart = new MimeBodyPart();

bodyPart.setText(body);

content.addBodyPart(bodyPart);

msg.setContent([color:orange]"body");

msg.setSubject([color:orange]"subject");

msg.setFrom(new InternetAddress([color:orange][email protected]));

msg.setRecipient(Message.RecipientType.TO, new InternetAddress([color:orange][email protected]));

Transport.send(msg);

return true;

Posted

ok, looks like in your last post you are now "hardcoding" the smpt server address. Is this working for you? What error are you getting?

This topic is 5614 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.