• 大小: 12KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: Java
  • 标签: java  邮件  

资源简介

用mailapi实现的java邮件客户端,能实现简单的邮件收发功能!

资源截图

代码片段和文件信息

import java.awt.*;
import sun.net.smtp.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import javax.swing.event.*;
import javax.swing.border.*;

public class MailClient extends Jframe{

protected SmtpClient sc;
protected JTextField senderadressessubjectserver;
protected JTextArea message;
protected JButton sendButton;
protected JLabel l1l2l3l4;
protected PrintStream ps;
protected JDialog dialogBox;
protected String toName=““;

public MailClient(){

/*******************************Graphical interface**************************/

super(“SMTP Mail Client“);
getContentPane().setLayout(new BorderLayout());

JPanel header = new JPanel();

JPanel p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
l1=new JLabel(“ To:          “);
l1.setForeground(Color.black);
p1.add(l1);
adresses=new JTextField(40);

adresses.addFocusListener(new FocusAdapter(){
public void focusGained(FocusEvent e){
l1.setForeground(new Color(98156245));
}
});

adresses.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
l1.setForeground(Color.black);
}
});

p1.add(adresses);

JPanel p2=new JPanel(new FlowLayout(FlowLayout.LEFT));
l2=new JLabel(“ From:      “);
l2.setForeground(Color.black);
p2.add(l2);
sender=new JTextField(40);
sender.addFocusListener(new FocusAdapter(){
public void focusGained(FocusEvent e){
l2.setForeground(new Color(98156245));
}
});

sender.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
l2.setForeground(Color.black);
}
});

p2.add(sender);

JPanel p3=new JPanel(new FlowLayout(FlowLayout.LEFT));
l3=new JLabel(“ Subject:   “);
l3.setForeground(Color.black);
p3.add(l3);
subject=new JTextField(40);
subject.addFocusListener(new FocusAdapter(){
public void focusGained(FocusEvent e){
l3.setForeground(new Color(98156245));
}
});

subject.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
l3.setForeground(Color.black);
}
});

p3.add(subject);

JPanel p=new JPanel(new FlowLayout(FlowLayout.LEFT));
l4=new JLabel(“ Server:   “);
l4.setForeground(Color.black);
p.add(l4);
server=new JTextField(40);
server.addFocusListener(new FocusAdapter(){
public void focusGained(FocusEvent e){
l4.setForeground(new Color(98156245));
}
});

server.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
l4.setForeground(Color.black);
}
});

p.add(server);


JLabel label=new JLabel(“JAVA MAIL CLIENT APPLICATION“);
label.setFont(new Font(“TimesRoman“Font.BOLD20));
label.setForeground(Color.blue);
label.setSize(25030);
label.setHorizontalAlignment(JLabel.CENTER);

header.setLayout(new GridLayout(51));
header.add(label);
header.add(p1);
header.add(p2);
header.add(p3);
header.add(p);

message=new JTextArea(7050);
message.setFont(new Font(“SansSerif“Font.BOLD14));
JScrollPane pScroll=new JScrollPane(message);
pScroll.setBorder(new titledBorder(new
EtchedBorder()“Mail Message“));

JPanel p4=new JPanel(new FlowLayout());
sendButton=new JButton(“SEND MESSAGE“);
sendButton.setM

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        226  2012-05-23 19:14  mailclient\.classpath

     文件        386  2012-05-23 19:14  mailclient\.project

     文件        740  2012-05-24 15:40  mailclient\MailClient$1.class

     文件        623  2012-05-24 15:40  mailclient\MailClient$10.class

     文件        757  2012-05-24 15:40  mailclient\MailClient$11.class

     文件        744  2012-05-24 15:40  mailclient\MailClient$2.class

     文件        740  2012-05-24 15:40  mailclient\MailClient$3.class

     文件        744  2012-05-24 15:40  mailclient\MailClient$4.class

     文件        740  2012-05-24 15:40  mailclient\MailClient$5.class

     文件        744  2012-05-24 15:40  mailclient\MailClient$6.class

     文件        740  2012-05-24 15:40  mailclient\MailClient$7.class

     文件        744  2012-05-24 15:40  mailclient\MailClient$8.class

     文件       1564  2012-05-24 15:40  mailclient\MailClient$9.class

     文件       5624  2012-05-24 15:40  mailclient\MailClient.class

     文件       5416  2002-01-12 23:22  mailclient\MailClient.java

     目录          0  2012-05-24 15:40  mailclient

----------- ---------  ---------- -----  ----

                20532                    16


评论

共有 条评论