|
I guess what I'm struggling with is whether these are supposed to all be in one big variable that has a varying size, or whether they're supposed to be in an array of variables with a varying number of elements. In other words, is this one variable or many variables?
I am sorry about not being clear in my last mail. Yes, the email addresses
are supposed to be in one big variable that has a varying size. This is one
variable. So, 'jakemorkel@xxxxxx, mikesparks@xxxxxx' is supposed to be only
one variable. I want this to be varying size so that if I want to have only
one email address my variable would be 'jakemorkel@xxxxxx'.
'accptargs4' is a Java class which is expecting 3 args. This code will
make it very clear. I should have attached it at the beginning itself, but
here it is...
***************************************************************************************************
import java.io.IOException;
import java.io.PrintStream;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.MimeMessage;
import sun.net.smtp.SmtpClient;
public class accptargs4
{
public static void main(String[] args)
throws IOException, StringIndexOutOfBoundsException,
MessagingException
{
String from = "MessagesSystem@xxxxxxxxxxxxxxxx";
String to = args[0];
String subject = args[1];
String messagetxt = args[2];
SmtpClient client = new SmtpClient("mail.mymaildomain.com");
client.from(from);
client.to(to);
java.util.Properties props = new java.util.Properties();
String smtpHost = "mail.mymaildomain.com";
String smtpPort = "25";
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port", ""+smtpPort);
Session session = Session.getDefaultInstance(props,null);
Message msg = new MimeMessage(session);
PrintStream message = client.startMessage();
message.println("To: "+to);
message.println("Received:" +new Date());
message.println("Subject:" + subject);
message.println();
message.println("This is a test message.");
message.println("Body:");
message.println();
message.println();
message.println();
message.close();
client.closeServer();
System.out.println("Email Was Sent!!");
}
}
**********************************************************************************************************
As, you can see the args[0] is expecting all the email addresses. So,
args[0] would be 'jakemorkel@xxxxxx, michaelsparks@xxxxxx, jimyates@xxxxxx'
or it could be 'jakemorkel@xxxxxx'(that is what I am looking for). Thank you
very much for your help. I really appreciate it.
cheers,
Jake.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.