Sure!
You have to have three import statements for the below code to work:
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
/////////////////////////////////////////////////////////
//Prepare and send e-mail message:
// create some properties and get the default Session
Properties props = new Properties();
props.put("mail.smtp.host", MutualFunds._projectProperties.
getProperty(MutualFunds.SMTP_SERVER));
Session session = Session.getDefaultInstance(props, null);
session.setDebug(false);
try
{
// create a message
MutualFunds._projectProperties.
getProperty(MutualFunds.EMAIL_FROM);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(MutualFunds._projectProperties.
getProperty(MutualFunds.EMAIL_FROM)));
InternetAddress[] addr = {new
InternetAddress(MutualFunds._projectProperties.
getProperty(MutualFunds.EMAIL_TO))};
msg.setRecipients(Message.RecipientType.TO, addr);
msg.setSentDate(new Date());
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(MutualFunds._projectProperties.
getProperty(MutualFunds.EMAIL_EXTRA_BODY)+"\n\n");
// create and fill the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// Use setText(text, charset), to show it off !
mbp2.setText(orderInfo+header+attachment, "us-ascii");
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
// send the message
Transport.send(msg);
}
catch (MessagingException mex)
{
CSpLog.send(this, CSpLog.ERROR, mex);
Exception ex = null;
if ((ex = mex.getNextException()) != null)
{
CSpLog.send(this, CSpLog.ERROR, mex);
}
return(next.loadx("system was unable to process your
order, please try again later"));
}
cleanup();
return(next.loadx("your order was successfully sent"));
}
////////////////////////////////////////////////////////
> -----Original Message-----
> From: Kaluza, Isabel SLGA [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, August 13, 1999 6:14 PM
> To: 'Partensky, Boris'
> Subject: RE: [ND] How to send Email from NetDynamics
>
> Hi
> I am dealing with the same issue below
> Can you send me a sample using java mail.
> Thanx!
>
> Isabel Kaluza
> Junior Systems Planning Analyst
> Saskatchewan Liquor and Gaming Authority
> <mailto:[EMAIL PROTECTED]>
>
>
>
>
> -----Original Message-----
> From: Partensky, Boris [mailto:[EMAIL PROTECTED]]
> Sent: Wed Aug 11, 1999 08:29 AM
> To: '[EMAIL PROTECTED]'
> Subject: [ND] How to send Email from NetDynamics
>
>
>
> > Hi, Sanjay!
> > We have several apps that send e-mail:
> >
> > 1. If you need to compose maltipart MIME messages, JavaMail is a good
> tool
> > for that, we use it to attach an ASCII file to an e-mail message.
> > Regarding your error:
> > did you add a path to acivation.jar to NETDYN_CLASSPATH ?
> > 2. If all you need is a simple SMTP message, you can use a simple
> Mailer
> > class that, I believe, is somewhere on NetDyn site. Also search the
> > archives, I am sure you will find it. If you don't, please let me know,
> > I'll send you the one we use, slightly modified. I think we added
> > recipient list support etc.
> >
> > HTH
> > Boris
> >
> > -----Original Message-----
> > From: Sanjay Kumar [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 11, 1999 3:31 AM
> > To: [EMAIL PROTECTED]
> > Subject: [ND] How to send Email from NetDynamics
> >
> >
> > If any body sending email from the netdynamics project please let me
> know
> > how It can be done.
> > I have downloaded javamail API and already set my classpath.
> > Now while sending the mail it is throwing execption for transportation
> > error.
> > If anybody know this please reply soon.
> >
> > Thanks in advance.
> >
> > SANJYA KUMAR
> >
> >
> _________________________________________________________________________
> >
> > For help in using, subscribing, and unsubscribing to the discussion
> > forums, please go to:
> http://www.netdynamics.com/support/visitdevfor.html
> >
> > For dire need help, email: [EMAIL PROTECTED]
> _________________________________________________________________________
>
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
> For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]