You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ricardo Bevilacqua <ri...@redmondsoftware.com> on 2013/02/15 22:44:01 UTC

Remove headers on multipart email

Hi to all!

I'm facing the following issue: my client has an SMTP server that
blocks incomming mails that have the "from" header for some reason. If
the mail doesn't have this header, it works.

So my question is if there is a chance to remove this header.

I've already tried to set the headers to "null" like this:

<code>

    email.setHeaders(null);

</code>

But that gives an exception. I also tried to set the From header empty:

<code>

    HashMap <String, String> headers = new HashMap<String, String>();
			
    headers.put("From", "");

    email.setHeaders(headers);

</code>

But that gives an exception as well.

Your help is greatly  appreciated.

Greetings,

Richard.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Remove headers on multipart email

Posted by Siegfried Goeschl <sg...@gmx.at>.
Hi Ricardo,

that is rather strange, since the "from" is the FROM address and is 
AFAIK mandatory according to RFC822 - so you are asked to send an 
invalid MimeMessage?! Can you check out if you can get the underlying 
MimeMessage (Email is just a wrapper) and tinker with it ...

Cheers,

Siegfried Goeschl

On 15.02.13 22:44, Ricardo Bevilacqua wrote:
> Hi to all!
>
> I'm facing the following issue: my client has an SMTP server that
> blocks incomming mails that have the "from" header for some reason. If
> the mail doesn't have this header, it works.
>
> So my question is if there is a chance to remove this header.
>
> I've already tried to set the headers to "null" like this:
>
> <code>
>
>      email.setHeaders(null);
>
> </code>
>
> But that gives an exception. I also tried to set the From header empty:
>
> <code>
>
>      HashMap <String, String> headers = new HashMap<String, String>();
> 			
>      headers.put("From", "");
>
>      email.setHeaders(headers);
>
> </code>
>
> But that gives an exception as well.
>
> Your help is greatly  appreciated.
>
> Greetings,
>
> Richard.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Remove headers on multipart email

Posted by "cacsar@gmail.com" <ca...@gmail.com>.
Here's the bit of the RFC. So the field is optional, but needless to say
blocking those messages is rather strange. Is it hoping to receive
automated messages only and rejecting spec compliant messages as a spam
control feature?

     4.4.1.  FROM / RESENT-FROM

        This field contains the identity of the person(s)  who  wished
        this  message to be sent.  The message-creation process should
        default this field  to  be  a  single,  authenticated  machine
        address,  indicating  the  AGENT  (person,  system or process)
        entering the message.  If this is not done, the "Sender" field
        MUST  be  present.  If the "From" field IS defaulted this way,
        the "Sender" field is  optional  and  is  redundant  with  the
        "From"  field.   In  all  cases, addresses in the "From" field
        must be machine-usable (addr-specs) and may not contain  named
        lists (groups).



On Sat, Feb 16, 2013 at 12:11 PM, Thomas Neidhart <thomas.neidhart@gmail.com
> wrote:

> On 02/15/2013 10:44 PM, Ricardo Bevilacqua wrote:
> > Hi to all!
> >
> > I'm facing the following issue: my client has an SMTP server that
> > blocks incomming mails that have the "from" header for some reason. If
> > the mail doesn't have this header, it works.
> >
> > So my question is if there is a chance to remove this header.
> >
> > I've already tried to set the headers to "null" like this:
> >
> > <code>
> >
> >     email.setHeaders(null);
> >
> > </code>
> >
> > But that gives an exception. I also tried to set the From header empty:
> >
> > <code>
> >
> >     HashMap <String, String> headers = new HashMap<String, String>();
> >
> >     headers.put("From", "");
> >
> >     email.setHeaders(headers);
> >
> > </code>
> >
> > But that gives an exception as well.
> >
> > Your help is greatly  appreciated.
>
> Hi,
>
> as Siegfried already mentioned, this is kind of odd. I would first
> investigate why the mail server rejects emails with a valid from header.
>
> If you really want to change/omit the from header you will have to use
> reflection to set it to a null value or update the embedded mime message
> (depending on whether buildMimeMessage has already been called in your
> case).
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: Remove headers on multipart email

Posted by Thomas Neidhart <th...@gmail.com>.
On 02/15/2013 10:44 PM, Ricardo Bevilacqua wrote:
> Hi to all!
> 
> I'm facing the following issue: my client has an SMTP server that
> blocks incomming mails that have the "from" header for some reason. If
> the mail doesn't have this header, it works.
> 
> So my question is if there is a chance to remove this header.
> 
> I've already tried to set the headers to "null" like this:
> 
> <code>
> 
>     email.setHeaders(null);
> 
> </code>
> 
> But that gives an exception. I also tried to set the From header empty:
> 
> <code>
> 
>     HashMap <String, String> headers = new HashMap<String, String>();
> 			
>     headers.put("From", "");
> 
>     email.setHeaders(headers);
> 
> </code>
> 
> But that gives an exception as well.
> 
> Your help is greatly  appreciated.

Hi,

as Siegfried already mentioned, this is kind of odd. I would first
investigate why the mail server rejects emails with a valid from header.

If you really want to change/omit the from header you will have to use
reflection to set it to a null value or update the embedded mime message
(depending on whether buildMimeMessage has already been called in your
case).

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: Remove headers on multipart email

Posted by Gabriel Rossetti <ga...@trafigura.com>.
I think this means that your client cannot receive emails from most people on earth :-), maybe you should do as described below and make sure there is not a config mistake, most if not all email clients will include the "From:" header. So unless this is an internal email only SMTP server (in this case you don't need anti spam software anyways since it's not visible to the outside world) then I would investigate.

What some servers do however is reject msgs that have a "From:" header that is not a valid/existing email from their domain (e.g. the SMTP servers domain is toto.com and the email is from joe@toto.com but no joe account exists) or the domain does not exist at all. One of these scenarios is probably what is happening, or a variant.

Cheers,
Gabriel
________________________________________
From: Ricardo Bevilacqua [rus.spes@gmail.com]
Sent: Friday, March 01, 2013 16:55
To: user@commons.apache.org
Subject: Re: Remove headers on multipart email

Hi,

Its a really odd thing that im asking, I know. I think the problem
with the server is that it rejects messages with a custom FROM as an
anti-spam feature, just like Caesar said. If I send a mail manually
with Telnet, without specifying the FROM field, the mail is sent.

Thanks in advance!

Richard.


On Sat, Feb 16, 2013 at 12:11 PM, Thomas Neidhart <thomas.neidhart@gmail.com
> wrote:

> On 02/15/2013 10:44 PM, Ricardo Bevilacqua wrote:
> > Hi to all!
> >
> > I'm facing the following issue: my client has an SMTP server that
> > blocks incomming mails that have the "from" header for some reason. If
> > the mail doesn't have this header, it works.
> >
> > So my question is if there is a chance to remove this header.
> >
> > I've already tried to set the headers to "null" like this:
> >
> > <code>
> >
> >     email.setHeaders(null);
> >
> > </code>
> >
> > But that gives an exception. I also tried to set the From header empty:
> >
> > <code>
> >
> >     HashMap <String, String> headers = new HashMap<String, String>();
> >
> >     headers.put("From", "");
> >
> >     email.setHeaders(headers);
> >
> > </code>
> >
> > But that gives an exception as well.
> >
> > Your help is greatly  appreciated.
>
> Hi,
>
> as Siegfried already mentioned, this is kind of odd. I would first
> investigate why the mail server rejects emails with a valid from header.
>
> If you really want to change/omit the from header you will have to use
> reflection to set it to a null value or update the embedded mime message
> (depending on whether buildMimeMessage has already been called in your
> case).
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


________________________________

This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Remove headers on multipart email

Posted by Ricardo Bevilacqua <ru...@gmail.com>.
Hi,

Its a really odd thing that im asking, I know. I think the problem
with the server is that it rejects messages with a custom FROM as an
anti-spam feature, just like Caesar said. If I send a mail manually
with Telnet, without specifying the FROM field, the mail is sent.

Thanks in advance!

Richard.


On Sat, Feb 16, 2013 at 12:11 PM, Thomas Neidhart <thomas.neidhart@gmail.com
> wrote:

> On 02/15/2013 10:44 PM, Ricardo Bevilacqua wrote:
> > Hi to all!
> >
> > I'm facing the following issue: my client has an SMTP server that
> > blocks incomming mails that have the "from" header for some reason. If
> > the mail doesn't have this header, it works.
> >
> > So my question is if there is a chance to remove this header.
> >
> > I've already tried to set the headers to "null" like this:
> >
> > <code>
> >
> >     email.setHeaders(null);
> >
> > </code>
> >
> > But that gives an exception. I also tried to set the From header empty:
> >
> > <code>
> >
> >     HashMap <String, String> headers = new HashMap<String, String>();
> >
> >     headers.put("From", "");
> >
> >     email.setHeaders(headers);
> >
> > </code>
> >
> > But that gives an exception as well.
> >
> > Your help is greatly  appreciated.
>
> Hi,
>
> as Siegfried already mentioned, this is kind of odd. I would first
> investigate why the mail server rejects emails with a valid from header.
>
> If you really want to change/omit the from header you will have to use
> reflection to set it to a null value or update the embedded mime message
> (depending on whether buildMimeMessage has already been called in your
> case).
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org