是说收电子邮件吧
如果是回答如下:
多种方式,要看手机的设计来定,通常有以下几种:
1、手机本身内置电子邮件接收程序,可以设置好邮箱地址,服务器,等信息接收
2、很多电子邮件服务商提供自己的电子邮件接收软件,可以按机型下载后安装到手机里,设置好后可收邮伯
3、可以登陆电子邮件的网站,很多电子邮件服务商都有手机版的电子邮件WAP网址(当然智能机可以也可像电脑一样直接登陆电脑版的网址)然后像电脑一样输入账户密码进入邮件看邮件
4、很多电子邮件服务商也提供短信服务,设置好后可以在邮件到达时短信提醒或直接把电子邮件内容通过短信形式发到手机上
以上1、2、3种方式需要手机开通上网功能,第4种通常能收短信就行,但如果开通上网功能应该可以看到更多内容
以上供您参考
import javaxmail;
import javaxmailinternet;
import javautil;
import javaio;
public class POP3Client {
public static void main(String[] args) {
Properties props = new Properties();
String host = "utopiapolyedu";
String username = "eharold";
String password = "mypassword";
String provider = "pop3";
try {
// Connect to the POP3 server
Session session = SessiongetDefaultInstance(props, null);
Store store = sessiongetStore(provider);
storeconnect(host, username, password);
// Open the folder
Folder inbox = storegetFolder("INBOX");
if (inbox == null) {
Systemoutprintln("No INBOX");
Systemexit(1);
}
inboxopen(FolderREAD_ONLY);
// Get the messages from the server
Message[] messages = inboxgetMessages();
for (int i = 0; i < messageslength; i++) {
Systemoutprintln("------------ Message " + (i+1)
+ " ------------");
messages[i]writeTo(Systemout);
}
// Close the connection
// but don't remove the messages from the server
inboxclose(false);
storeclose();
} catch (Exception ex) {
exprintStackTrace();
}
}
}
protected void SendSuccess()
{
SystemNetMailMailMessage message = new SystemNetMailMailMessage();
messageFrom = new MailAddress("test@gmailcom", "someone");//必须是提供smtp服务的邮件服务器
messageToAdd(new MailAddress("test@yahoocomcn"));
messageSubject = "测试邮件" ;
messageCCAdd(new MailAddress("test@126com"));
messageBccAdd(new MailAddress("test@126com"));
messageIsBodyHtml = true;
messageBodyEncoding = SystemTextEncodingUTF8;
messageBody = "邮件发送测试";
messagePriority = SystemNetMailMailPriorityHigh;
SmtpClient client = new SmtpClient("smtpgmailcom", 587); // 587;//Gmail使用的端口
clientCredentials = new SystemNetNetworkCredential("test@gmailcom", "password"); //这里是申请的邮箱和密码
clientEnableSsl = true; //必须经过ssl加密
try
{
clientSend(message);
ResponseWrite("邮件已经成功发送到" + messageToToString() + "<br>");
}
catch (Exception ee)
{
ResponseWrite(eeMessage + "<br>" / + eeInnerExceptionMessage/ );
}
}
收邮件
using LumiSoftNetPOP3Client;
using LumiSoftNetMail;
……
public IList<Mail_Message> ReceiveMail()
{
IList<Mail_Message> mailList = new List<Mail_Message>();
using (POP3_Client client = new POP3_Client())
{
clientConnect("popgmailcom",995,true);
clientAuthenticate("zwseaman", "zw_seaman", false);
POP3_ClientMessageCollection coll = clientMessages;
for (int i = 0; i < collCount; i++)
{
POP3_ClientMessage message = coll[i];
Mail_Message mm = Mail_MessageParseFromByte(coll[i]MessageToByte());
mailListAdd(mm);
}
}
return mailList;
}
protected void Page_Load(object sender, EventArgs e)
{
IList<Mail_Message> mailList = new ZMailMail()ReceiveMail();
foreach (Mail_Message mail in mailList)
{
StringBuilder sb = new StringBuilder();
sbAppend(mailFromToString())Append(" 发送给 ");
sbAppend(mailToToString())Append("<br/>") ;
sbAppend(mailSubject)Append("<br/>");
sbAppend(mailBodyHtmlText)Append("<hr/>");
ResponseWrite(sbToString());
}
}
界面自己写一下就可以了,把相关的参数传进去就可以了。 这个是我以前写的。用的javamail。 有main方法,测试一下自己的邮件,应该没问题的。希望可以帮到你。注意导入你需要的javamailjar的包 -------------------------------------------------------------- package comfourpanemail; import javautilProperties; import javaxmailAddress; import javaxmailFlags; import javaxmailFolder; import javaxmailMessage; import javaxmailMessagingException; import javaxmailNoSuchProviderException; import javaxmailSession; import javaxmailStore; import javaxmailTransport; import javaxmailinternetAddressException; import javaxmailinternetInternetAddress; import javaxmailinternetMimeMessage; public class TestMail { public static void main(String[] args) { //TestMailsendMail(); //TestMailreceiveMail(); TestMaildeleteMail(); } / send mail / public static void sendMail() { String host = "smtpsinacom";//邮件服务器 String from = "xingui5624@sinacom";//发件人地址 String to = "ilovenumen@vipsinacom";//接受地址(必须支持pop3协议) String userName = "xingui5624";//发件人邮件名称 String pwd = "";//发件人邮件密码 Properties props = new Properties(); propsput("mailsmtphost", host); propsput("mailsmtpauth", "true"); Session session = SessiongetDefaultInstance(props); sessionsetDebug(true); MimeMessage msg = new MimeMessage(session); try { msgsetFrom(new InternetAddress(from)); msgaddRecipient(MessageRecipientTypeTO, new InternetAddress(to));//发送 msgsetSubject("我的测试");//邮件主题 msgsetText("测试内容。。。。。。。");//邮件内容 msgsaveChanges(); Transport transport = sessiongetTransport("smtp"); transportconnect(host, userName, pwd);//邮件服务器验证 transportsendMessage(msg, msggetRecipients(MessageRecipientTypeTO)); Systemoutprintln("send ok"); } catch (AddressException e) { eprintStackTrace(); } catch (MessagingException e) { eprintStackTrace(); } } / receive mail / public static void receiveMail() { String host = "pop3sinacom"; String userName = "xingui5624"; String passWord = ""; Properties props = new Properties(); Session session = SessiongetDefaultInstance(props); sessionsetDebug(true); try { Systemoutprintln("receive"); Store store = sessiongetStore("pop3"); storeconnect(host, userName,passWord);//验证 Folder folder = storegetFolder("INBOX");//取得收件文件夹 folderopen(FolderREAD_WRITE); Message msg[] = foldergetMessages(); Systemoutprintln("邮件个数:" + msglength); for(int i=0; i<msglength; i++) { Message message = msg[i]; Address address[] = messagegetFrom(); StringBuffer from = new StringBuffer(); / 此for循环是我项目测试用的 / for(int j=0; j<addresslength; j++) { if (j > 0) fromappend(";"); fromappend(address[j]toString()); } Systemoutprintln(messagegetMessageNumber()); Systemoutprintln("来自:" + fromtoString()); Systemoutprintln("大小:" + messagegetSize()); Systemoutprintln("主题:" + messagegetSubject()); Systemoutprintln("时间::" + messagegetSentDate()); Systemoutprintln("==================================================="); } folderclose(true);//设置关闭 storeclose(); Systemoutprintln("receive over"); } catch (NoSuchProviderException e) { eprintStackTrace(); } catch (MessagingException e) { eprintStackTrace(); } } / delete mail / public static void deleteMail() { String host = "pop3sinacom"; String userName = "xingui5624"; String passWord = ""; Properties props = new Properties(); //Properties props = SystemgetProperties();这种方法创建 Porperties 同上 Session session = SessiongetDefaultInstance(props); sessionsetDebug(true); try { Systemoutprintln("begin delete "); Store store = sessiongetStore("pop3"); storeconnect(host, userName, passWord);//验证邮箱 Folder folder = storegetFolder("INBOX"); folderopen(FolderREAD_WRITE);//设置我读写方式打开 int countOfAll = foldergetMessageCount();//取得邮件个数 int unReadCount = foldergetUnreadMessageCount();//已读个数 int newOfCount = foldergetNewMessageCount();//未读个数 Systemoutprintln("总个数:" +countOfAll); Systemoutprintln("已读个数:" +unReadCount); Systemoutprintln("未读个数:" +newOfCount); for(int i=1; i<=countOfAll; i++) { Message message = foldergetMessage(i); messagesetFlag(FlagsFlagDELETED, true);//设置已删除状态为true if(messageisSet(FlagsFlagDELETED)) Systemoutprintln("已经删除第"+i+"邮件。。。。。。。。。"); } folderclose(true); storeclose(); Systemoutprintln("delete ok"); } catch (NoSuchProviderException e) { eprintStackTrace(); } catch (MessagingException e) { eprintStackTrace(); } } / reply mail / public static void replyMail() { //test } } 注意:此实现要求邮箱都支持pop3和smtp协议。现在老的网易邮箱都支持(2006年以前注册的),所以的sina的 qq的都可以,雅虎的部分支持,具体的可以在网上搜下把。 ============================================================================== 还有一种办法,也是我以前用到的。 其实最简单的发邮件方式是用Apache的Common组件中的Email组件,封装得很不错。 特简单。首先从Sun的网站上下载JavaMail框架实现,最新的版本是141。然后是JavaBeans Activation Framework,最新版本111,JavaMail需要这个框架。不过如果JDK是16的话就不用下了。16已经包括了JavaBeans Activation Framework。 最后从 >
以上就是关于用手机怎么接收邮件全部的内容,包括:用手机怎么接收邮件、求一个简单java编写的邮件收发程序,邮件发送程序为smtpsend,邮件接收程序为popreceive。急需,感谢。、用C#编写一个收发邮件的小程序,求代码和原理简单讲解等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)