2 Replies Latest reply on Apr 12, 2004 2:20 PM by acoliver

    Issue with From and To headers when sending to a remote syst

    kabirkhan

      Hi,

      While testing my changes in http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3826358#3826358 I found an issue that seems to have been around for some time. I did a test with the version I had on my machine last week before I started making my changes in and got the same results then.

      The problem seems to be that when a mail is sent from a client to JBoss-Mail and then sent to another mail server, the other mail server adds an extra set of To and From headers! I have tried this to three different mail servers and it seems to be happening every time.
      It also seems to happen regardless of mail client used, I have tried Outlook Express, Thunderbird and telnet.


      >>>> This shows JBoss's output on receiving the data from the client, and the JavaMail debug output when the data is sent to the other SMTP server. As you can see there is only one To and one From.

      2004-03-18 18:37:55,087 DEBUG [org.jboss.mail.AbstractProtocol] ReadCommand outputting DATA

      2004-03-18 18:37:55,087 DEBUG [org.jboss.mail.smtp.SMTPProtocolInstance] HandleRequest called with request = false
      2004-03-18 18:37:55,087 DEBUG [org.jboss.mail.smtp.SMTPProtocolInstance] HandleRequest called with command = DATA
      2004-03-18 18:37:55,087 DEBUG [org.jboss.mail.smtp.handlers.CmdDATA] DATA command handler called
      2004-03-18 18:37:55,087 DEBUG [org.jboss.mail.message.Mail] MAIL constructor called
      2004-03-18 18:37:55,087 INFO [org.jboss.mail.message.Mail] all headers after loading: MailHeadersImpl (13): [hdr(Return-Path = 'Return-Path: <kabirkhan@bigfoot.com>'), hdr(Received = 'Received: from kkhan (127.0.0.1 127.0.0.1) by badmojo.superlinksoftware.com (127.0.0.1)
      with SMTP id 1079631475087829.7809256907842; Thu, 18 Mar 2004 18:37:55 +0100 (CET)'), hdr(Message-ID = 'Message-ID: <010501c40d0f$beda61f0$a66b1fd9@EMS.COM>'), hdr(From = 'From: "Kabir Khan" <kabirkhan@bigfoot.com>'), hdr(To = 'To: "Kabir Khan" <kabirkhan@hotmail.com>'), hdr(Subject = 'Subject: Test'), hdr(Date = 'Date: Thu, 18 Mar 2004 18:37:50 +0100'), hdr(MIME-Version = 'MIME-Version: 1.0'), hdr(Content-Type = 'Content-Type: multipart/alternative;
      boundary="----=_NextPart_000_0102_01C40D18.1E1538E0"'), hdr(X-Priority = 'X-Priority: 3'), hdr(X-MSMail-Priority = 'X-MSMail-Priority: Normal'), hdr(X-Mailer = 'X-Mailer: Microsoft Outlook Express 6.00.2800.1158'), hdr(X-MimeOLE = 'X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165')]
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] MAIL BODY: This is a multi-part message in MIME format.

      ------=_NextPart_000_0102_01C40D18.1E1538E0
      Content-Type: text/plain;
      charset="iso-8859-1"
      Content-Transfer-Encoding: quoted-printable


      ------=_NextPart_000_0102_01C40D18.1E1538E0
      Content-Type: text/html;
      charset="iso-8859-1"
      Content-Transfer-Encoding: quoted-printable

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

      <META http-equiv=3DContent-Type content=3D"text/html; =
      charset=3Diso-8859-1">
      <META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>


      <BODY bgColor=3D#ffffff>
       

      ------=_NextPart_000_0102_01C40D18.1E1538E0--

      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] Return-Path: <kabirkhan@bigfoot.com>
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] Received: from kkhan (127.0.0.1 127.0.0.1) by badmojo.superlinksoftware.com (127.0.0.1)
      with SMTP id 1079631475087829.7809256907842; Thu, 18 Mar 2004 18:37:55 +0100 (CET)
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] Message-ID: <010501c40d0f$beda61f0$a66b1fd9@EMS.COM>
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] From: "Kabir Khan" <kabirkhan@bigfoot.com>
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] To: "Kabir Khan" <kabirkhan@hotmail.com>
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] Subject: Test
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] Date: Thu, 18 Mar 2004 18:37:50 +0100
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] MIME-Version: 1.0
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] Content-Type: multipart/alternative;
      boundary="----=_NextPart_000_0102_01C40D18.1E1538E0"
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] X-Priority: 3
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] X-MSMail-Priority: Normal
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] X-Mailer: Microsoft Outlook Express 6.00.2800.1158
      2004-03-18 18:37:55,097 DEBUG [org.jboss.mail.message.Mail] X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
      2004-03-18 18:37:55,097 INFO [org.jboss.mail.smtp.handlers.CmdDATA] sending to mail to MailListener: org.jboss.mail.maillistener.JMXMailListenerProxy@a7bd7a
      2004-03-18 18:37:55,267 DEBUG [org.jboss.mail.mailhandler.remote.RemoteDeliveryMessageDrivenBean] Attempting remote delivery to: <kabirkhan@hotmail.com>
      2004-03-18 18:37:55,287 INFO [STDOUT] DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
      2004-03-18 18:37:55,297 INFO [STDOUT] DEBUG SMTP: useEhlo true, useAuth false
      2004-03-18 18:37:55,297 INFO [STDOUT]
      DEBUG: SMTPTransport trying to connect to host "mx3.hotmail.com.", port 25
      2004-03-18 18:37:56,258 DEBUG [org.jboss.mail.AbstractProtocol] ReadCommand outputting QUIT

      2004-03-18 18:37:56,258 DEBUG [org.jboss.mail.smtp.SMTPProtocolInstance] HandleRequest called with request = false
      2004-03-18 18:37:56,258 DEBUG [org.jboss.mail.smtp.SMTPProtocolInstance] HandleRequest called with command = QUIT
      2004-03-18 18:37:56,258 DEBUG [org.jboss.mail.smtp.handlers.CmdQUIT] QUIT command handler called
      2004-03-18 18:37:56,258 DEBUG [org.jboss.mail.ServerThreadPool] freeing org.jboss.mail.ServerThread@19f9c7a
      2004-03-18 18:37:56,318 INFO [STDOUT] DEBUG SMTP RCVD: 220 mc11-f35.hotmail.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.6824 ready at Thu, 18 Mar 2004 09:30:12 -0800
      2004-03-18 18:37:56,318 INFO [STDOUT] DEBUG: SMTPTransport connected to host "mx3.hotmail.com.", port: 25
      2004-03-18 18:37:56,318 INFO [STDOUT] DEBUG SMTP SENT: EHLO kkhan
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP RCVD: 250-mc11-f35.hotmail.com (02.04.01.0012) Hello [217.31.107.166]
      250-SIZE 29696000
      250-PIPELINING
      250-8bitmime
      250-BINARYMIME
      250-CHUNKING
      250-VRFY
      250-AUTH LOGIN
      250-AUTH=LOGIN
      250-X-HMAUTH
      250 OK
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "SIZE", arg "29696000"
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "PIPELINING", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "8bitmime", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "BINARYMIME", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "CHUNKING", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "VRFY", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "AUTH", arg "LOGIN"
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "AUTH=LOGIN", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "X-HMAUTH", arg ""
      2004-03-18 18:37:57,440 INFO [STDOUT] DEBUG SMTP Found extension "OK", arg ""
      2004-03-18 18:37:57,450 DEBUG [org.jboss.mail.smtp.sender.SMTPSender] text = This is a multi-part message in MIME format.

      ------=_NextPart_000_0102_01C40D18.1E1538E0
      Content-Type: text/plain;
      charset="iso-8859-1"
      Content-Transfer-Encoding: quoted-printable


      ------=_NextPart_000_0102_01C40D18.1E1538E0
      Content-Type: text/html;
      charset="iso-8859-1"
      Content-Transfer-Encoding: quoted-printable

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

      <META http-equiv=3DContent-Type content=3D"text/html; =
      charset=3Diso-8859-1">
      <META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>


      <BODY bgColor=3D#ffffff>
       

      ------=_NextPart_000_0102_01C40D18.1E1538E0--

      2004-03-18 18:37:57,450 INFO [STDOUT] DEBUG SMTP: use8bit false
      2004-03-18 18:37:57,450 INFO [STDOUT] DEBUG SMTP SENT: MAIL FROM:<kabirkhan@bigfoot.com>
      2004-03-18 18:37:58,251 INFO [STDOUT] DEBUG SMTP RCVD: 250 kabirkhan@bigfoot.com....Sender OK
      2004-03-18 18:37:58,251 INFO [STDOUT] DEBUG SMTP SENT: RCPT TO:<kabirkhan@hotmail.com>
      2004-03-18 18:37:59,944 INFO [STDOUT] DEBUG SMTP RCVD: 250 kabirkhan@hotmail.com
      2004-03-18 18:37:59,954 INFO [STDOUT] Verified Addresses
      2004-03-18 18:37:59,954 INFO [STDOUT] kabirkhan@hotmail.com
      2004-03-18 18:37:59,954 INFO [STDOUT] DEBUG SMTP SENT: DATA
      2004-03-18 18:38:00,735 INFO [STDOUT] DEBUG SMTP RCVD: 354 Start mail input; end with .
      2004-03-18 18:38:00,745 INFO [STDOUT] DEBUG SMTP SENT:
      .
      2004-03-18 18:38:05,061 INFO [STDOUT] DEBUG SMTP RCVD: 250 <2734153.1079631480745.JavaMail.KKhan@kkhan> Queued mail for delivery
      2004-03-18 18:38:05,061 INFO [STDOUT] DEBUG SMTP SENT: QUIT


      >>>>>>>>>>>>> When connected to my mailbox kabirkhan@hotmail.com the received message source has extra TO and From headers

      X-Message-Info: 6sSXyD95QpXxzIjWIKHZ7LzUx21ek2FE
      Received: from kkhan ([217.31.107.166]) by mc11-f35.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824);
      Thu, 18 Mar 2004 09:30:17 -0800
      Return-Path: <kabirkhan@bigfoot.com>
      Received: from kkhan (127.0.0.1 127.0.0.1) by badmojo.superlinksoftware.com (127.0.0.1)
      with SMTP id 1079631475087829.7809256907842; Thu, 18 Mar 2004 18:37:55 +0100 (CET)
      Message-ID: <2734153.1079631480745.JavaMail.KKhan@kkhan>
      Date: Thu, 18 Mar 2004 18:37:50 +0100
      From: kabirkhan@bigfoot.com
      From: "Kabir Khan" <kabirkhan@bigfoot.com>
      To: kabirkhan@hotmail.com
      To: "Kabir Khan" <kabirkhan@hotmail.com>
      Subject: Test
      Mime-Version: 1.0
      Content-Type: multipart/alternative;
      boundary="----=_NextPart_000_0102_01C40D18.1E1538E0"
      Content-Transfer-Encoding: 7bit
      X-Priority: 3
      X-MSMail-Priority: Normal
      X-Mailer: Microsoft Outlook Express 6.00.2800.1158
      X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
      X-OriginalArrivalTime: 18 Mar 2004 17:30:20.0100 (UTC) FILETIME=[AFA8E040:01C40D0E]

      This is a multi-part message in MIME format.

      ------=_NextPart_000_0102_01C40D18.1E1538E0
      Content-Type: text/plain;
      charset="iso-8859-1"
      Content-Transfer-Encoding: quoted-printable


      ------=_NextPart_000_0102_01C40D18.1E1538E0
      Content-Type: text/html;
      charset="iso-8859-1"
      Content-Transfer-Encoding: quoted-printable

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

      <META http-equiv=3DContent-Type content=3D"text/html; =
      charset=3Diso-8859-1">
      <META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>


      <BODY bgColor=3D#ffffff>
       

      ------=_NextPart_000_0102_01C40D18.1E1538E0--


      Cheers,

      Kab



        • 1. Re: Issue with From and To headers when sending to a remote
          kabirkhan

          Phew! This was due to two things in SMTPSender.send():

          1) To, CC, BCC & From headers get set by calling the direct methods on MimeMessage. i.e.:
          MimeMessage.addRecipients()
          MimeMessage.setFrom()

          I am now avoiding setting these headers again in the same way as was done for Subject. There was a big fat comment which I took to mean something like this, so that is fine now. BTW, I added the standard headers stuff, not here as indicated but to MailHeadersImpl when the headers are being loaded from the DATA stream, since they are also needed for incoming messages.

          b) Removed a for loop that would call MimeMessage.addRecipient() (which takes an array of all recipients) once for each
          recipient, meaning if you had four To recipients you would get four To headers with all four recipients in each.

          Cheers,

          Kab

          • 2. Re: Issue with From and To headers when sending to a remote
            acoliver

            Not sure where you said this but you said you weren't sure that multiple messages were delivered when two receipients were in the same domain (meaning andy at superlink and acoliver at superlink). I said I'd test that. I tested it and it worked. Nice work dude.