on 06-12-2007 2:24 PM
HI,
How to get the email id of the currently logged in user, using webdynpro for java 2004.
How to send an email using webdynpro for java with attachments.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have sent you one WebDynpro Application of sending mails.. Please try to follow the things I have done.. Please don't forget to reward points as I have sent you one sample project for your referance...
If you need further help let me know..
Thanks and Regards\
Avijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the foll. code for getting the email of Logged in User.
IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();
IUser user = clientUser.getSAPUser();
emailId = user.getEmail();
Reward points if it helps.
Regards
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have one sample application that you can use as referance to build your mail sending appliucation.. paste your mail address here and I will send you the sample application which will give u clear idea about coding...
Thanks and Regards
Avijit Dhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai,
// get the logged in user mail id
IWDClientUser wdUser = WDClientUser.getCurrentUser();
user = wdUser.getSAPUser();
String email=user.getEmail();
// send mail as an attachment
try
{
Properties props = System.getProperties();
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(body);
msg.setHeader("X-Mailer", " Email");
msg.setSentDate(new Date());
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText("Hai , This mail Generated By the Program");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource("C:
nag.xls");
messageBodyPart.setDataHandler( new DataHandler(source));
messageBodyPart.setFileName("nag.xls");
multipart.addBodyPart(messageBodyPart);
// Put parts in message
msg.setContent(multipart);
Transport.send(msg);
System.out.println("Message sent OK.");
}
catch (Exception ex)
{
ex.printStackTrace();
}
Regards,
Naga
HI,
Use the following code for sending mail from current login user.
try{
IWDClientUser user = WDClientUser.getCurrentUser();
String mailTo = "xxx@yahoo.com";
String remarkDetail = "Your proposal has been reviewed.";
String subjectDetail = "Request for new proposal ";
String mailSenderFirstName = user.getSAPUser().getFirstName();
String mailSenderLastName = user.getSAPUser().getLastName();
String host = "<put the SMTP host name>";
String mailBody = remarkDetail + "\n xxxxx xxxx xxxx xxxxx." +"\n\n Thanks & Regards" +"\n" + " " + mailSenderFirstName +" " + mailSenderLastName;
Authenticator authenticator = null;
// try{
// IWDClientUser user = WDClientUser.getCurrentUser();
String mailFrom = user.getSAPUser().getEmail();
InternetAddress [ ] addresses_from = { new InternetAddress (mailFrom)};
InternetAddress [ ] addresses_to = {new InternetAddress ( mailTo )};
Properties properties = new Properties ( );
properties.put ( "mail.smtp.host", host );
MimeMessage msg = new MimeMessage (
Session.getInstance ( properties, authenticator ) );
msg.addFrom(addresses_from);
msg.setRecipients ( Message.RecipientType.TO , mailTo );
msg.setRecipients ( Message.RecipientType.CC , addresses_cc );
//msg.setRecipients ( Message.RecipientType.BCC, addresses_bcc );
msg.setSubject (subjectDetail);
msg.setText ( mailBody );
Transport.send ( msg );
} catch (AddressException ae)
{
ae.printStackTrace();
}
catch (MessagingException me)
{
me.printStackTrace();
}
catch(Exception e)
{
}
Now Import the followings
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
Thanks and regards
Chandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Go Thro this thread : Thread 352711
Regards
Chandran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.