Hi, there

I'd like to forward an email message.
Please tell me any idea.


    Properties props = new Properties();
    Session session = Session.getDefaultInstance(props, null);

    // From
    message.addHeader("Resent-From", MYACCOUNT);                // my
GAE account address
    InternetAddress fromAddress = new InternetAddress(from);
    message.setFrom(fromAddress);

    // Sender
    message.addHeader("Resent-Sender", MYACCOUNT);                //
my GAE account address
    message.addHeader("Sender", fromAddress.getAddress());

    // To
    message.addHeader("Resent-To",
resentTo);                        // I wanna forward this email at him
    InternetAddress toList[] = InternetAddress.parse(to, false);
    message.addRecipients(MimeMessage.RecipientType.TO, toList);    //
TO address list including me

    message.setSubject(subject);

    message.setText(message);

    Transport transport = session.getTransport();
    transport.connect();
    InternetAddress resentToList[] = InternetAddress.parse(resentTo,
false);
    transport.sendMessage(message,
resentToList);                    // send to Resent-To address
    transport.close();


Thanks,



On Dec 19, 2:11 am, minor-undroid <[email protected]> wrote:
> I'd like to make an e-mail forward by GAE withResent-To/Resent-From
> header.
>
> I tried the "client Java program with JavaMail" that I made,
> and got the suitable result.
> I applied ...
>   mail.host:       smtp.gmail.com
>   mail.smtp.auth:  true
>   mail.smtp.socketFactory.port: 465
>   mail.smtp.starttls.enable:    true
>   ...and more...
>
> and Message Header is ...
>  Resent-From ; [email protected]            // my admin account
>  Resent-To :   [email protected]
>  Resent-Date:  Mon, 30 Nov 2009 12:59:59 +0000  // Exactly now
>   From:         yyyf...@ccc,com
>   To:           [email protected]
>   Date:         Sun, 01 Nov 2009 12:59:59 +0000  // Past date
>
> so, the result was good (It was just what I had expected).
> The response header is above.
>   An e-mail looks like
>     -- comming from yyyf...@ccc,com.
>     -- comming at 01 Nov 2009.
>     -- going to [email protected], but he([email protected]) didn't get
>        this e-mail, but another([email protected]) got this mail.
>
> Then I tried that I implemented above code and a few fixed code,
> and deployed on GAE, ran this application on GAE, but it left log
> as warnings as follows.
>   Failed: Send failure (javax.mail.MessagingException:
>           Illegal Arguments (java.lang.IllegalArgumentException:
>           Unauthorized Sender: Unauthorized sender))
> or
>   Failed: Unable to locate provider for protocol: smtp
> or
>   Failed: Illegal Arguments (java.lang.IllegalArgumentException:
>           Bad Request: Missing recipients)
>
> Does anyobody know a solution to this ?
> What I want to do is to functionResent-To/Resent-From header
> appropriately !
>
> Thanks,

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to