Results 1 to 7 of 7
  1. #1
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default email received has To: undisclosed-recipients:

    I built an email simple only send , app
    using code like below but email received has To: undisclosed-recipients:

    not the inserted real email well, what other way exist to send email in Java SE with To, the actual To field contents?

    Java Code:
     88.   public void sendMail()
     89.   {
     90.      try
     91.      {
     92.         Socket s = new Socket(smtpServer.getText(), 25);
     93.
     94.         InputStream inStream = s.getInputStream();
     95.         OutputStream outStream = s.getOutputStream();
     96.
     97.         in = new Scanner(inStream);
     98.         out = new PrintWriter(outStream, true /* autoFlush */);
     99.
    100.         String hostName = InetAddress.getLocalHost().getHostName();
    101.
    102.         receive();
    103.         send("HELO " + hostName);
    104.         receive();
    105.         send("MAIL FROM: <" + from.getText() + ">");
    106.         receive();
    107.         send("RCPT TO: <" + to.getText() + ">");
    108.         receive();
    109.         send("DATA");
    110.         receive();
    111.         send(message.getText());
    112.         send(".");
    113.         receive();
    114.         s.close();
    115.       }
    116.       catch (IOException e)
    117.       {
    118.          comm.append("Error: " + e);
    119.       }
    120.    }
    121.
    122.    /**
    123.     * Sends a string to the socket and echoes it in the comm text area.
    124.     * @param s the string to send.
    125.     */
    126.    public void send(String s) throws IOException
    127.    {
    128.       comm.append(s);
    129.       comm.append("\n");
    130.       out.print(s.replaceAll("\n", "\r\n"));
    131.       out.print("\r\n");
    132.       out.flush();
    133.    }
    134.
    135.    /**
    136.     * Receives a string from the socket and displays it in the comm text area.
    137.     */
    138.    public void receive() throws IOException
    139.    {
    140.       String line = in.nextLine();
    141.       comm.append(line);
    142.       comm.append("\n");
    143.    }

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default

    No, I mean:
    The (received) email I test it to, I send with mine address(To) come as:
    1)no subject
    2)To: field equals>undisclosed-recipients:

    I want To: shown my own address as destinated address or in case send email elesewhere person, the destinated address of him(his address)
    and
    Subject field to have a relative subject...well?

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by lse123 View Post
    No, I mean:
    The (received) email I test it to, I send with mine address(To) come as:
    1)no subject
    2)To: field equals>undisclosed-recipients:

    I want To: shown my own address as destinated address or in case send email elesewhere person, the destinated address of him(his address)
    and
    Subject field to have a relative subject...well?
    Okay, looking at your code, can you tell me where/how you set the receivers emails address and the subject line?

  5. #5
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default I must use for the requested point, package JavaMail API???

    Java Code:
    105.         send("MAIL FROM: <" + from.getText() + ">");
    106.         receive();
    107.         send("RCPT TO: <" + to.getText() + ">");
    HOW MANY WAYS EXIST IN SENDING JAVA SE EMAIL ?
    I must use for the requested point, package JavaMail API???

    exist and other ways to achive this?

    after fwd received email I get in body:
    Java Code:
    webmaster@poliscarhire.eu  // these 2 lines appear by default after fwd any msg
    webmaster@poliscarhire.com
    
    -----Original Message-----
    From: a080725@cytanet.com.cy [mailto:a080725@cytanet.com.cy] 
    Sent: Monday, May 03, 2010 12:20 AM
    To: undisclosed-recipients:
    Subject: 
    
    test one
    two
    jnjnjnm
    
    ,mnmnmn,m
    ,n,mn,mn,
     ,m,mnmn
    nm,mnmn
    nmn,n,
    and in subject:
    Java Code:
    FW:

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    12,995
    Blog Entries
    7
    Rep Power
    19

    Default

    You should use Sun's Java Mail API; you can set the recipients type to BCC (Blank Carbon Copy) a.k.a. undisclosed recipients.

    kind regards,

    Jos

Similar Threads

  1. Reg : PGP Encryption using Recipients Key
    By Deepa in forum New To Java
    Replies: 0
    Last Post: 08-31-2009, 12:28 PM
  2. detecting data received is malicious or not
    By prashant in forum Networking
    Replies: 2
    Last Post: 02-02-2009, 03:58 PM
  3. saving bytes received in different request
    By renuka_anil in forum Java Servlet
    Replies: 18
    Last Post: 12-26-2008, 12:12 PM
  4. send email using apache commons email
    By jnamendi in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 10-14-2008, 05:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •