I did this configuration
email.server.enabled=true
email.server.port=25
email.server.domain=alfresco.com
email.inbound.unknownUser=anonymous
email.server.allowed.senders=.*
In Class
Properties mailServerProperties = new Properties();
mailServerProperties = System.getProperties();
mailServerProperties.put("mail.smtp.host", "localhost");
mailServerProperties.put("mail.smtp.port", "25");
Session session = Session.getDefaultInstance(mailServerProperties, null);
session.setDebug(false);
Message message = new MimeMessage(session);
String fromAddress = "admin@alfresco.com";
message.setFrom(new InternetAddress(fromAddress));
message.addRecipient(Message.RecipientType.TO, new InternetAddress("dharmrajgurjar1990@gmail.com"));
message.setSubject(subject);
// Create the message part with body text
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(body);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Create the Attachment part
//
// Get the document content bytes
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
Transport.send(message);
But i am getting this error:
org.alfresco.error.AlfrescoRuntimeException: 06090023 Could not send email: 554 The email address '
dharmrajgurjar1990@gmail.com' does not reference a valid accessible node.