当前位置: 首页 > news >正文

c 做网站公司注销后网站备案

c 做网站,公司注销后网站备案,做网站时遇到的问题,长沙的互联网网站公司哪家好抽象 本博客的目的是演示如何使用Java Mail通过具有SSL连接的SMTP服务器发送电子邮件。 免责声明 这篇文章仅供参考。 在使用所提供的任何信息之前#xff0c;请认真思考。 从中学到东西#xff0c;但最终自己做出决定#xff0c;风险自负。 要求 我使用以下主要技术完成了… 抽象 本博客的目的是演示如何使用Java Mail通过具有SSL连接的SMTP服务器发送电子邮件。 免责声明 这篇文章仅供参考。 在使用所提供的任何信息之前请认真思考。 从中学到东西但最终自己做出决定风险自负。 要求 我使用以下主要技术完成了本文的所有工作。 您可能可以使用不同的技术或版本来做相同的事情但不能保证。 NetBeans 11.2 Maven 3.3.9与NetBeans捆绑在一起 Java 11zulu11.35.15-ca-jdk11.0.5-win_x64 dependency groupIdjavax.mail/groupId artifactIdmail/artifactId version 1.4 /version scopetest/scope /dependency 下载 访问我的GitHub页面https://github.com/mjremijan以查看我所有的开源项目。 这个职位的代码位于https://github.com/mjremijan/thoth-email中https://github.com/mjremijan/thoth-email/tree/master/thoth-email-via-ssl模块。 物产 本示例使用smtp-ssl-yahoo.properties文件保存SMTP服务器信息。 我使用了我个人的Yahoo! 帐户进行测试因此在属性文件的名称中使用单词yahoo 。 重要的是文件的内容如清单1所示。 清单1 –属性文件 # This is the name of the SMTP host machine. host # This is the port number of the SMTP host machine. # The same host may support both SSL and TLS but on # different ports. So make sure you get the SSL port. port # This is what you use in the “username” field when # you login. Typically # you login. Typically this is the same as your email # address, but this isnt always the case . username # This is what you use in the “password” field when # you login. This value is CLEAR TEXT, so keep # you login. This value is CLEAR TEXT, so keep this # properties file safe. password # This is the email address you want for the # emails FROM field. Enter the value using # the format shown below. Typically # the format shown below. Typically this is # just your email address for the account. fromFIRSTNAME LASTNAME ADDRESS EMAIL .COM # This is the email address you want for the # emails REPLY_TO field. Enter the value using # the format shown below. Typically # the format shown below. Typically this is # just your email address for the account. Also the account. Also # typically this is the same as from above. # But be warned, if an emails FROM and REPLY_TO # are different, thats may be flagged as spam # and never be delivered. So keep from and # reply the same for initial testing replyFIRSTNAME LASTNAME ADDRESS EMAIL .COM # This is the email address you want to send # the email to. For testing, its a good idea # to send it to yourself first. toFIRSTNAME LASTNAME ADDRESS EMAIL .COM 现在您有了属性文件接下来让我们看一下代码。 码 这是一个JUnit测试演示了如何使用Java Mail通过具有SSL连接的SMTP服务器发送电子邮件。 清单2显示了代码。 注意对于初始测试请始终检查您的SPAM文件夹。 可以始终添加一条规则以将其传送到您的INBOX。 清单2 – Java Mail示例 package org.thoth.email.via.ssl; import java.net.InetAddress; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class SslTest { public SslTest() { } String now, hostname; protected String now, hostname; Properties yahoo; protected Properties yahoo; BeforeEach public void setUp() throws Exception { now new SimpleDateFormat( MM-dd-yyyy hh:mm:ss a ).format( new Date()); hostname InetAddress.getLocalHost().getHostName(); yahoo new Properties(); yahoo.load( this .getClass().getResourceAsStream( /smtp-ssl-yahoo.properties )); } Test public void a_test() throws Exception { // Create MimeMultipart MimeMultipart content new MimeMultipart( related ); // html part { MimeBodyPart textPart new MimeBodyPart(); textPart.setText( htmlbody pTime: now /p pFrom: hostname /p /body/html , UTF8 , html ); content.addBodyPart(textPart); } // properties Properties props new Properties(); { props.setProperty( mail.smtp.auth , true ); props.setProperty( mail.smtp.host , yahoo.getProperty( host )); props.setProperty( mail.smtp.socketFactory.port , yahoo.getProperty( port )); props.setProperty( mail.smtp.socketFactory.class , javax.net.ssl.SSLSocketFactory ); } Session smtp null ; { smtp Session.getInstance(props, new Authenticator() { Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( yahoo.getProperty( username ) , yahoo.getProperty( password ) ); } }); smtp.setDebug( true ); smtp.setDebugOut(System.out); } MimeMessage m new MimeMessage(smtp); { m.setRecipient(Message.RecipientType.TO, new InternetAddress(yahoo.getProperty( to ))); m.setSubject( thoth-email SSL test now); InternetAddress from null ; { from new InternetAddress(yahoo.getProperty( from )); from.setPersonal( Thoth Email ); m.setFrom(from); } InternetAddress reply null ; { reply new InternetAddress(yahoo.getProperty( reply )); m.setReplyTo( new InternetAddress[] {reply}); } m.setContent(content); } Transport.send(m); } } 摘要 发送邮件的代码不是很困难。 成功接收电子邮件而不将其标记为垃圾邮件是另一回事。 但是如果您遵循此示例请使用有效的帐户并且不要过度使用它则应该可以。 该博客显示了如何使用Java Mail通过具有SSL连接的SMTP服务器发送电子邮件。 翻译自: https://www.javacodegeeks.com/2020/02/java-mail-sent-over-ssl.html
http://www.yutouwan.com/news/123074/

相关文章:

  • 手机微信网站怎么做的好处搭建网上商城
  • 有哪些ui的设计网站蜘蛛搜索引擎
  • 网站排名优化服务公司中国跨境电商前三名
  • seo网站计划书电子商务网站发展建设
  • h5网站模板源码建设网站费用一般多少
  • 福州网站制作公司营销wordpress tag 列表
  • 南昌网站建设优化公司排名电子商务论文网站建设
  • 做直播教程的网站推广普通话黑板报内容
  • 佛山市网站建站网站win8 metro风格网站后台管理模板
  • 网站建设七个步骤凡科活动不良记录多久解除
  • linux做网站服务器吗wordpress绑定手机号
  • 服装微信商城网站建设公司介绍怎么写
  • 开发手机端网站模板手机端是什么
  • 网站开发最快的语言wordpress postname
  • 做网站最大的公司郑州最新出入通知
  • 最受欢迎的wordpress主题廊坊企业网站排名优化
  • 做国外直播网站成都网站优化维护
  • 电商网站制作在线直播系统开发
  • 做试玩网站推广展示类网站
  • 珠宝网站制作的理念如何向google提交网站
  • 手机网站设计公司可去亿企邦火车头wordpress 5.1
  • wordpress自定义站点wordpress cms模板制作
  • 免费wap自助建站系统设计师需要了解的网站
  • 拟定网站优化方案泰州网站设计培训
  • 做国际网站有用吗天河网站建设价格
  • 上海网站设计专注乐云seo项目网站建设方案模板
  • 上海做网站 公司青岛提供网站建设哪家便宜
  • 北京正规网站建设公司哪家好体育网站建设
  • 网站设计技能西安网络公司大全
  • saas源码优化的网站做域名跳转