求助,我的程序为什么会错
import java.io.*;import java.net.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class J_mail {
public static void main(String[] args)
{
String host=new String("SMTP.163.com");
String from=new String("xwf310@163.com");
String to=new String("xwf310@163.com");
String cc=null;
String subject=new String("163");
String msg=new String("SMTP.163.com");
try
{
Properties props=System.getProperties();
props.put("mail.smtp.host", "host");
Session m_session =Session.getDefaultInstance(props, null);
//创建Message对象
Message m=new MimeMessage(m_session);
//InternetAddress[] iAddr=null;
//设置发送人
m.setFrom(new InternetAddress(from));
//设置接受人
m.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to,false));
//抄送地址
if((cc!=null)&&(cc.trim().length()>0))
{
m.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc,false));
}
//设置主题
m.setSubject(subject);
//设置消息内容
m.setContent(msg,"text/plain");
//发送时间
m.setSentDate(new Date());
//发送信息
Transport.send(m);
System.out.println("发送成功");
}
catch(Exception ex)
{
System.out.println("发送失败");
}
}
}