You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by prakash <pr...@collab.net> on 2010/07/15 16:15:58 UTC

How to send mail as "On Behalf Of"?

Hi,

I'm using james.2.2.0 version. I'm try to send mail from james like
"user1@mydomain.com" on behalf of "user2@mydomain.com".

I tried below ways, but none of them seems to work. I'm in missing
anything?.

1) InternetAddress sender = new InternetAddress();
  sender.setAddress("user1@mydomain.com"); 
  message.setSender(sender);

2) message.setHeader("FROM:","user1@mydomain.com");

3) message.setHeader("X-Sender","user1@mydomain.com");

4)message.setHeader("MAIL FROM:","user1@mydomain.com");

Any suggestions?

Thanks,
Prakash.

RE: How to send mail as "On Behalf Of"?

Posted by Prakash Chinnakannan <pr...@collab.net>.
Thanks for reply Norman, we do Transport.send(message, addresses); where message is MimeMessage and address is InternetAddress[].

How you "inject" the email to james ? Via SMTP ?

Bye,
Norman

2010/7/15 prakash <pr...@collab.net>:
> Hi,
>
> I'm using james.2.2.0 version. I'm try to send mail from james like
> "user1@mydomain.com" on behalf of "user2@mydomain.com".
>
> I tried below ways, but none of them seems to work. I'm in missing
> anything?.
>
> 1) InternetAddress sender = new InternetAddress();
>  sender.setAddress("user1@mydomain.com");
>  message.setSender(sender);
>
> 2) message.setHeader("FROM:","user1@mydomain.com");
>
> 3) message.setHeader("X-Sender","user1@mydomain.com");
>
> 4)message.setHeader("MAIL FROM:","user1@mydomain.com");
>
> Any suggestions?
>
> Thanks,
> Prakash.
>

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




Re: How to send mail as "On Behalf Of"?

Posted by Norman Maurer <no...@apache.org>.
How you "inject" the email to james ? Via SMTP ?

Bye,
Norman

2010/7/15 prakash <pr...@collab.net>:
> Hi,
>
> I'm using james.2.2.0 version. I'm try to send mail from james like
> "user1@mydomain.com" on behalf of "user2@mydomain.com".
>
> I tried below ways, but none of them seems to work. I'm in missing
> anything?.
>
> 1) InternetAddress sender = new InternetAddress();
>  sender.setAddress("user1@mydomain.com");
>  message.setSender(sender);
>
> 2) message.setHeader("FROM:","user1@mydomain.com");
>
> 3) message.setHeader("X-Sender","user1@mydomain.com");
>
> 4)message.setHeader("MAIL FROM:","user1@mydomain.com");
>
> Any suggestions?
>
> Thanks,
> Prakash.
>

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


Re: How to send mail as "On Behalf Of"?

Posted by prakash <pr...@collab.net>.
Thanks for your reply Daniele, I will have a try on this.

On Thu, 2010-07-15 at 16:50 +0200, Daniele Lozzi wrote:

> Hi prakash,
> 
> Try
> 
> cast your MimeMessage to com.sun.mail.smtp.SMTPMessage
> 
> SMTPMessage smtpMessage = new SMTPMessage(message);
> smtpMessage.setHeader("Sender", "user1@mydomain.com");
> smtpMessage.setFrom(new IntenetAddress("user2@mydomain.com"));
> smtpMessage.setEnvelopeFrom(new IntenetAddress("user1@mydomain.com"));
> 
> bye
> 
> 
> 
> Il 15/07/2010 16:15, prakash ha scritto:
> > Hi,
> >
> > I'm using james.2.2.0 version. I'm try to send mail from james like
> > "user1@mydomain.com" on behalf of "user2@mydomain.com".
> >
> > I tried below ways, but none of them seems to work. I'm in missing
> > anything?.
> >
> > 1) InternetAddress sender = new InternetAddress();
> >    sender.setAddress("user1@mydomain.com");
> >    message.setSender(sender);
> >
> > 2) message.setHeader("FROM:","user1@mydomain.com");
> >
> > 3) message.setHeader("X-Sender","user1@mydomain.com");
> >
> > 4)message.setHeader("MAIL FROM:","user1@mydomain.com");
> >
> > Any suggestions?
> >
> > Thanks,
> > Prakash.
> >
> >    
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org



Re: How to send mail as "On Behalf Of"?

Posted by Daniele Lozzi <dl...@babel.it>.
Hi prakash,

Try

cast your MimeMessage to com.sun.mail.smtp.SMTPMessage

SMTPMessage smtpMessage = new SMTPMessage(message);
smtpMessage.setHeader("Sender", "user1@mydomain.com");
smtpMessage.setFrom(new IntenetAddress("user2@mydomain.com"));
smtpMessage.setEnvelopeFrom(new IntenetAddress("user1@mydomain.com"));

bye



Il 15/07/2010 16:15, prakash ha scritto:
> Hi,
>
> I'm using james.2.2.0 version. I'm try to send mail from james like
> "user1@mydomain.com" on behalf of "user2@mydomain.com".
>
> I tried below ways, but none of them seems to work. I'm in missing
> anything?.
>
> 1) InternetAddress sender = new InternetAddress();
>    sender.setAddress("user1@mydomain.com");
>    message.setSender(sender);
>
> 2) message.setHeader("FROM:","user1@mydomain.com");
>
> 3) message.setHeader("X-Sender","user1@mydomain.com");
>
> 4)message.setHeader("MAIL FROM:","user1@mydomain.com");
>
> Any suggestions?
>
> Thanks,
> Prakash.
>
>    


-- 
Ad Maiora,

Daniele Lozzi
Programmer at Babel srl
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIDENZIALE: Questo messaggio ed i suoi allegati sono di carattere confidenziale per i destinatari in indirizzo.
E' vietato l'inoltro non autorizzato a destinatari diversi da quelli indicati nel messaggio originale.
Se ricevuto per errore, l'uso del contenuto e' proibito; si prega di comunicarlo al mittente e cancellarlo immediatamente.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------




Re: How to send mail as "On Behalf Of"?

Posted by prakash <pr...@collab.net>.
Thanks for reply Ekaterina, Will have a try and let u know.

On Thu, 2010-07-15 at 08:45 -0600, Ekaterina Davydenko wrote:

> s.2.

Re: How to send mail as "On Behalf Of"?

Posted by Ekaterina Davydenko <ed...@lanl.gov>.
Change

sender.setAddress("user1@mydomain.com");  

to 

sender.setAddress("user2@mydomain.com"); 


prakash wrote:
> Hi,
>
> I'm using james.2.2.0 version. I'm try to send mail from james like
> "user1@mydomain.com" on behalf of "user2@mydomain.com".
>
> I tried below ways, but none of them seems to work. I'm in missing
> anything?.
>
> 1) InternetAddress sender = new InternetAddress();
>   sender.setAddress("user1@mydomain.com"); 
>   message.setSender(sender);
>
> 2) message.setHeader("FROM:","user1@mydomain.com");
>
> 3) message.setHeader("X-Sender","user1@mydomain.com");
>
> 4)message.setHeader("MAIL FROM:","user1@mydomain.com");
>
> Any suggestions?
>
> Thanks,
> Prakash.
>
>   

-- 


//
\\ Ekaterina A. Davydenko
// HPC-1 Scientific Software Engineering Group
\\ Los Alamos National Laboratory
// PO Box 1663, MS B274   
\\ Los Alamos, NM 87545
// phone: (505)665-1096
\\ email: edav@lanl.gov
//


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