Skip to Content
author's profile photo Former Member
Former Member

SENDING MAILS IN WEBDYNPRO JAVA

Hi,

Can anyone send the code for sending mails from webdynpro (JAVA) APPLICATION using JAVA API .. ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2006 at 09:06 AM

    Hi

    See this Thread

    using-smtp-to-send-mail

    using-smtp-to-send-mail

    Kind Regards

    Mukesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 17, 2006 at 09:07 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 17, 2006 at 09:14 AM

    Hi,

    You can use this following code.

    import javax.mail.*;

    import java.util.*;

    import javax.mail.internet.*;

    class Mail

    {

    public static void main(String s[])

    {

    Session ses=null;

    Message msg=null;

    try

    {

    Properties p=System.getProperties();

    //Properties p=new Properties();

    p.put("mail.smtp.host","host");

    p.put("mail.transport.protocol","smtp");

    p.put("mail.smtp.auth","false");

    p.put ("mail.smtp.port", "25");

    boolean sessionDebug=true;

    Authenticator a=new Auth("usr","pwde");

    ses=Session.getInstance(p,a);

    ses.setDebug(sessionDebug);

    msg=new MimeMessage(ses);

    msg.setFrom(new InternetAddress("fahadibm@gmail.com"));

    (Message.RecipientType.TO,address[0]); msg.setRecipient(Message.RecipientType.TO,new InternetAddress("imran@abc.com"));

    msg.setSubject("Test");

    msg.setSentDate(new Date());

    msg.setText("This is a Test");

    }

    catch(Exception e)

    {

    System.out.println("E1"+e);

    }

    try

    {

    Transport.send(msg);

    }

    catch(Exception e)

    {

    System.out.println("Exception is"+e);

    }

    }

    }

    class Auth extends Authenticator

    {

    String name;

    String pwd;

    public Auth(String name,String pwd)

    {

    this.name=name;

    this.pwd=pwd;

    }

    public PasswordAuthentication getAuthenticate()

    {

    return new PasswordAuthentication(name,pwd);

    }

    }

    For more info, go thru these links.

    /thread/25456 [original link is broken]

    using-smtp-to-send-mail

    Regards,

    Sridhar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.