• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOmailer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOmailer


  • Subject: Re: WOmailer
  • From: Nathan Dumar <email@hidden>
  • Date: Wed, 1 Dec 2004 15:10:16 -0500

Dave,

I don't know what "Email page" you're talking about. I can't answer your question, but I'm happy to share my code with you. Maybe it will help you fix the problem that you're having. I have the following class:

import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.Session;
import java.util.*;
import alt.dev.jmta.*;
import com.sun.mail.smtp.*;

public class aMailer {

public static void sendAMessage(String from, String to, String subject, String body) {
Properties props = new Properties();
props.put("mail.smtp.host", "AN SMTP SERVER ADDRESS");
Session session = Session.getInstance(props);
try {
Message aMessage = new MimeMessage(session);
aMessage.setSentDate(new Date());
aMessage.setFrom(new InternetAddress(from));
aMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
aMessage.setSubject(subject);
aMessage.setText(body);
Transport.send(aMessage);
}
catch (SendFailedException sfex) { System.out.println(sfex); }
catch (MessagingException mex) { System.out.println(mex); }
return;
}
}




Anywhere else in your code, just do

aMailer.sendAMessage("email@hidden","email@hidden","Th e subject text","The body text");


You can do it in an action that returns null, returns a nextPage, or anywhere else.


It took me a LONG time to put these few lines of code together.

Take care,
Nathan


On Dec 1, 2004, at 11:01 AM, David Griffith wrote:

Hi all,

A quick question on JavaMail. When using ERJavaMail to send a mail, it also
attempts to display that page in the browser. In one particular instance, I
call a method that creates and sends the mail and then returns a different
page entirely which works fine. However if I want to send the mail and
return the current page in it's current state, I would normally return null
to just refresh the existing page. However it appears that at the point
where I return null it has already 'gone' to the Email page. Is there some
way to tell it to send the mail 'in the background' so to speak so that it
does not affect the page the user is currently viewing?


Thanks,
Dave.

Most abandon this early because it's so buggy.  I use JavaMail.

Nathan


On Nov 30, 2004, at 7:43 PM, Jeremy Matthews wrote:

Does anyone use this?
Most of the devs I spoke to utilize the ERMailer in WONDER, or edit
the javamail API's directly.

Thanks,
Jeremy

_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
david.griffith@infinit
y.ie


This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: WOmailer (From: David Griffith <email@hidden>)

  • Prev by Date: Re: ATTN: No Valid Key for WebObjects in the developers download area; only old expired key posted.
  • Next by Date: Re: WOmailer
  • Previous by thread: Re: WOmailer
  • Next by thread: Re: WOmailer
  • Index(es):
    • Date
    • Thread