more than one email reciver. like this eamil
more than one email reciver. like this eamil
- Subject: more than one email reciver. like this eamil
- From: "Sako!" <email@hidden>
- Date: Tue, 18 May 2004 15:56:58 +0200
hi, i read the emails from DB as String
some values are email@hidden;email@hidden
i mean to emails.
i use this code to send the eamils.
----------------------------------------------------------------------------
-------------------------------
application class
try
{
WOMail.sendMail(host, from, to, "Test Mail", "MailPage");
}catch (Exception e) {
System.out.println("Error !! :" + e.getMessage());
}
----------------------------------------------------------------------------
-------------------------------
mailer class
static String mimeType = "text/html; charset=windows-1254";
static String encoding = "Cp1254";
/*** utility function for composing message from given parameters ***/
// host : smtp host
// from : sender's mail adr.
// from : receiver's mail adr.
// subject : subject of mail. No Non US-ASCII character !!
// content : content of mail message
private static MimeMessage makeMessage(String host, String from, String
to, String subject, String content) throws Exception
{
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
javax.mail.Session session =
javax.mail.Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipients(Message.RecipientType.TO, to);
message.setSubject(from);
message.setContent(content,mimeType);
return message;
}
/*** sends mail message ***/
public static void sendMail(String host, String from, String to, String
subject, String content) throws Exception
{
System.out.println("to : " + to);
Transport.send(makeMessage(host, from, to, subject, content));
}
----------------------------------------------------------------------------
-------------------------------
if i send to one email email@hidden it works fine
how can i seperate the emails elegantly?
something like
NSArray specialistEmailAdresses = NSArray.componentsSeparatedByString
(to,";");
thank you
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.