cancel
Showing results for 
Search instead for 
Did you mean: 

sending email using SMTP to Outlook

Former Member
0 Kudos

Hi all,

any one knows how to send email using SMTP from webdynpro application to Outlook. Please reply.

Thank you

Maruthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Make sure you maintain you java mail client settings in Visual Admin

use the following code example to send mail messages

Properties props = new Properties();
				props.put("domain", "true");
				Context initialContext = new InitialContext(props);
				Session sess = (Session) initialContext.lookup("java:comp/env/mail/MailSession");
				Session mailSession = Session.getDefaultInstance(sess.getProperties());
				Transport transport = mailSession.getTransport("smtp");
				//MimeMessage message = new MimeMessage(sess);
				MimeMessage message = new MimeMessage(mailSession);
				message.setSubject("Your ERP Portal Certificate");
				message.setFrom(new InternetAddress("portal@portal.com"));
				message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(userArr.getEmail()));
				//
				// This HTML mail have to 2 part, the BODY and the embedded image
				//
				MimeMultipart multipart = new MimeMultipart("related");
				// first part  (the html)
				BodyPart messageBodyPart = new MimeBodyPart();
				String htmlText ="Dear ERP user , </b>"	;													messageBodyPart.setContent(htmlText, "text/html");
				// add it
				multipart.addBodyPart(messageBodyPart);
				// put everything together
				message.setContent(multipart);
				transport.connect();
				transport.sendMessage(message, message.getRecipients(javax.mail.Message.RecipientType.TO));
				transport.close();
				proxy.gotoPage("umHelpPage");
				uidUserCreatteLog(userArr.getEmail());
			}

Theo

Answers (1)

Answers (1)

Former Member
0 Kudos

Maruti,

Check your NetWeaver IDE installation: there is a directory "examples" (at the same level where eclipse.exe located) and one tutorial covers sending JavaMail (both tutorial text and sample project should be there).

VS

Former Member
0 Kudos

Thank you Valery,

I tried it.It look like I cam seeing the output properly.But It din't send me anymails.I just wonder why?

Former Member
0 Kudos

Maruti,

As suggested, check your e-mail settings:

1. Run <b>Visual Administrator</b>: DRIVE:/usr/sap/L##/JC##/j2ee/admin/go.bat (here # stays for number, L -- for letter)

2. Navigate to <b>Server .../Services/JavaMail client</b>. Replace "localhost" with real server names here.

VS