Click here to Skip to main content
15,891,762 members
Home / Discussions / Java
   

Java

 
QuestionHow to do zigzag scanning in java Pin
Flying_Doc29-Apr-09 18:57
Flying_Doc29-Apr-09 18:57 
Questionmoving a graphic Pin
jonig1928-Apr-09 16:13
jonig1928-Apr-09 16:13 
AnswerRe: moving a graphic Pin
Nagy Vilmos28-Apr-09 23:01
professionalNagy Vilmos28-Apr-09 23:01 
Question[Message Deleted] Pin
jonig1928-Apr-09 10:46
jonig1928-Apr-09 10:46 
AnswerRe: move() graphics Pin
fly90428-Apr-09 11:37
fly90428-Apr-09 11:37 
Questionsaving files with current date and time as their names Pin
nicks1128528-Apr-09 2:01
nicks1128528-Apr-09 2:01 
AnswerRe: saving files with current date and time as their names Pin
Jimmanuel28-Apr-09 3:09
Jimmanuel28-Apr-09 3:09 
Questionsending an e-mail Pin
prasadbuddhika26-Apr-09 20:25
prasadbuddhika26-Apr-09 20:25 
i found the code for sending e-mail , but my problem is that mail is not received by the recipient .


public void postMail(String recipients[], String subject, String message, String from) throws MessagingException {
        boolean debug = false;


        Properties props = new Properties();
        props.put("mail.smtp.host", "smtp.gmail.com");

        System.out.println("step 1 ");
        

        Session session = Session.getDefaultInstance(props, null);
        session.setDebug(debug);

        Message msg = new MimeMessage(session);

       InternetAddress addressFrom = new InternetAddress(from);
        msg.setFrom(addressFrom);

        InternetAddress[] addressTo = new InternetAddress[recipients.length];
        for (int i = 0; i < recipients.length; i++) {
            addressTo[i] = new InternetAddress(recipients[i]);
        }
        msg.setRecipients(Message.RecipientType.TO, addressTo);

       msg.addHeader("MyHeaderName", "myHeaderValue");
        msg.setSubject(subject);
        msg.setContent(message, "text/plain");

        Transport.send(msg);
    } 


i call this method with

String [] st = new String[1];
           st[0] = "nuwan";

this.postMail(st, "test", "prasadbuddhika42@gmail.com", "prasadbuddhika42@gmail.com");


can anyone tell me what is wrong in this code ?
AnswerRe: sending an e-mail Pin
Gil Messerman27-Apr-09 6:03
Gil Messerman27-Apr-09 6:03 
GeneralRe: sending an e-mail Pin
shrims4u17-May-09 6:48
shrims4u17-May-09 6:48 
Questionjava recursion problem Pin
harshad bhatia26-Apr-09 2:13
harshad bhatia26-Apr-09 2:13 
AnswerRe: java recursion problem Pin
CPallini26-Apr-09 23:26
mveCPallini26-Apr-09 23:26 
GeneralRe: java recursion problem Pin
harshad bhatia27-Apr-09 0:22
harshad bhatia27-Apr-09 0:22 
GeneralRe: java recursion problem Pin
CPallini27-Apr-09 0:39
mveCPallini27-Apr-09 0:39 
GeneralRe: java recursion problem Pin
harshad bhatia27-Apr-09 0:51
harshad bhatia27-Apr-09 0:51 
QuestionRe: java recursion problem Pin
CPallini27-Apr-09 0:57
mveCPallini27-Apr-09 0:57 
AnswerRe: java recursion problem Pin
harshad bhatia27-Apr-09 1:08
harshad bhatia27-Apr-09 1:08 
GeneralRe: java recursion problem Pin
harshad bhatia27-Apr-09 1:14
harshad bhatia27-Apr-09 1:14 
QuestionI am new in Java Programming please help me. Pin
WebMaster25-Apr-09 11:13
WebMaster25-Apr-09 11:13 
AnswerRe: I am new in Java Programming please help me. Pin
fly90425-Apr-09 11:25
fly90425-Apr-09 11:25 
AnswerRe: I am new in Java Programming please help me. Pin
CPallini26-Apr-09 23:28
mveCPallini26-Apr-09 23:28 
Questionhow to use JAXRPC Pin
prakash_chhipa24-Apr-09 23:34
prakash_chhipa24-Apr-09 23:34 
Generaljava applet in tower of hanoi Pin
Hohepa Hori24-Apr-09 21:17
Hohepa Hori24-Apr-09 21:17 
GeneralRe: java applet in tower of hanoi Pin
CPallini26-Apr-09 23:30
mveCPallini26-Apr-09 23:30 
QuestionRational Application Developer (RAD) and Java Faces really seems to suck! Pin
Ray Cassick24-Apr-09 10:51
Ray Cassick24-Apr-09 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.