3

I can send mails with gmail with javamail

But i cannot set the reply to anyhow...

the code i m using is...

   //the actual mail id someone@gmail.com
   ccAddress = new InternetAddress( "someone+something@gmail.com");

        msg.setFrom(ccAddress);

        Address[] addresses = new Address[1];
        //actually i want to addressee to reply-to
        addresses[0] = new InternetAddress( "someone@yahoo.com" );
        msg.setReplyTo(addresses);

        msg.setSubject(subject);
        msg.setText(text);
        msg.setHeader("MIME-Version" , "1.0" );
        msg.setHeader("Content-Type" , "text/html" );
        msg.setHeader("X-Mailer", "Recommend-It Mailer V2.03c02");
General Grievance
  • 4,555
  • 31
  • 31
  • 45
Pradyut Bhattacharya
  • 5,440
  • 13
  • 53
  • 83

1 Answers1

0

Before you call transport.sendMessage(), try calling msg.saveChanges()
The send() function calls this before calling sendMessage(), but if you are using sendMessage() yourself, you will have to call this to make sure any headers are saved.

robert_x44
  • 9,224
  • 1
  • 32
  • 37