作业帮 > 综合 > 作业

new Address[]()那里报The left-hand side of an assignment must b

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/09 03:36:07
new Address[]()那里报The left-hand side of an assignment must be a variable错误、
package com.sxt.mail;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class MailConnection {
\x05public static void main(String[] args) throws Exception {
\x05\x05Properties props = new Properties();
\x05\x05props.setProperty("mail.debug","");
\x05\x05Session session = Session.getInstance(props);
\x05\x05Message msg = new MimeMessage(session);
\x05\x05msg.setText("你好吗?");
\x05\x05msg.setFrom(new InternetAddress("meimei@sohu.com"));
\x05\x05Transport transport = session.getTransport();
\x05\x05transport.connect("smtp.sohu.com",25,"wstc","123456");
\x05\x05transport.send(msg,new Address[](new InternetAddress("wstc@sohu.com")));
\x05\x05transport.close();
\x05}
}
Address[](new InternetAddress("wstc@sohu.com"))-->
Address[]{new InternetAddress("wstc@sohu.com")}