Yes, it is working as you mentioned. I did find the same situation that
someone had posted earlier though. Setting the from works but in the
received email, I get a different address, someone at the gateway. Did your
email arrive with the from that you had set?

Thanks:)

Scott
----- Original Message -----
From: "Colin Chalmers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 18, 2001 1:30 PM
Subject: Re: mail message


> Hi Scott,
>
> I tested your snippet using my version below And everything worked great!!
> The only problem I had was if I set the headers to "", otherwise.....No
> probs.
>
> I would check that the parameters you're trying to read from are indeed
> filled (write to logfile and/or screen) and/or put the code in a try/catch
> block. That way you should see what the errors are.
>
> Let me know how you get on.
>
> /Colin
>
> <snip>
>           MailMessage mail = new MailMessage();
>              // set mail properties
>              mail.setHost("192.168.1.1");
>              mail.setDebug(true);
>             // mail.setHeaders("");
>
>            mail.setFrom("collie@localhost");
>              mail.setTo("[EMAIL PROTECTED]");
>              // check if Cc: is null
>              mail.setCc("[EMAIL PROTECTED]");
>              mail.setSubject("MailmessageTest");
>              mail.setBody("Message");
>              // send mail and verify result
>              boolean result = mail.send();
> </snip>
>
>
> ----- Original Message -----
> From: "Scott A. Roehrig" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, October 18, 2001 6:25 PM
> Subject: mail message
>
>
> > In looking through the api docs, I am hoping that this is a simple
coding
> > error. Would anyone have any thoughts on this snippet of code designed
to
> > send a simple email using the MailMessage class. I don't return an
> > exception, but then again I never receive the email. I am sending it
> through
> > a remote mail gateway. I define the host in the descriptor.
> >
> >             // create turbine email
> >              MailMessage mail = new MailMessage();
> >              // set mail properties
> >              mail.setHost(config.getAttribute("host"));
> >              file://mail.setDebug(config.getAttribute("debug"));
> >              file://mail.setHeaders("");
> >
> >
mail.setFrom(request.getSession().getUser().getGivenName()+"@localhost");
> >              mail.setTo(request.getParameter("To"));
> >              // check if Cc: is null
> >              if (request.getParameter("Cc") != null) {
> >                 mail.setCc(request.getParameter("Cc"));
> >              }
> >              mail.setSubject(request.getParameter("Subject"));
> >              mail.setBody(request.getParameter("Message"));
> >              // send mail and verify result
> >              boolean result = mail.send();
> >
> > Thanks for any thoughts:)
> >
> > Scott
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to