后缀spring.com的邮箱怎么登陆
企业邮箱只要mail.后缀就可以打开登陆界面了。
如果打不开,就要问负责人,登陆地址是什么。
但通过查询无法知道是什么提供商的。但通过mail.域名写的是开源通讯和协作办公系统的业界领袖
查询方式:
运行cmd---nslookup---set q=mx---域名回车即可查看mx解析记录,
希望对你有所帮助!
怎样使用Spring发邮件
先来看看发送Email吧, 在Spring中发送Email是很简单的,使用Spring提高的MailSender和MailMessage就可以了,配置代码如下:
?xml version="1.0" encoding="UTF-8"?
!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "spring-beans.dtd"
beans
bean id="mailSender" class="e258-e86a-c4a2-0a1e org.springframework.mail.javamail.JavaMailSenderImpl"
property name="host"
valuesmtp.163.com/value
/property
property name="javaMailProperties"
props
!-- 如果要使用用户名和密码验证,这一步需要 --
prop key="mail.smtp.auth"true/prop
/props
/property
property name="username"
value你的Email地址/value
/property
property name="password"
value你的Email密码/value
/property
/bean
!-- 简单的message --
bean id="mailMessage" class="e86a-c4a2-0a1e-4647 org.springframework.mail.SimpleMailMessage"
property name="to"
value收件人地址/value
/property
property name="from"
value你的地址/value
/property
property name="subject" !-- Email 标题 --
valueA Spring Mail sender/value
/property
/bean
!-- 测试发送的类 --
bean id="testMailSender" class="c4a2-0a1e-4647-3240 test.mail.TestSenderMail"
property name="mailMessage"
ref bean="mailMessage"/
/property
property name="mailSender"
ref bean="mailSender"/
/property
/bean
/beans
上面的配置好以后就可以直接发送了, 看看TestSenderMail.java的代码:
package test.mail;
import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
public class TestSenderMail {
private MailSender mailSender;
private SimpleMailMessage mailMessage;
public TestSenderMail() { }
public SimpleMailMessage getMailMessage() {
return mailMessage; }
public void setMailMessage(SimpleMailMessage mailMessage) {
this.mailMessage = mailMessage; }
public MailSender getMailSender() {
return mailSender; }
public void setMailSender(MailSender mailSender) {
this.mailSender = mailSender; }
public void sendMail() {
SimpleMailMessage message = new SimpleMailMessage(mailMessage); //设置email内容,
message.setText("测试Spring 发送Email.");
try {
mailSender.send(message);
} catch (MailException e) {
System.out.println("O . 发送Email失败了....");
e.printStackTrace();
}
}
}
很简单吧. 下面是测试类: TestApp.java
package test.mail;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestApp {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext( "test/mail/mail.xml");
TestSenderMail sender = (TestSenderMail) context .getBean("testMailSender");
sender.sendMail();
}
//抛出如下异常,是瑞星监控的问题,关闭就可以了
/** * DEBUG SMTP: QUIT failed with 250 O . 发送Email失败了....
* org.springframework.mail.MailSendException: Could not send mails: 354
* * com.sun.mail.smtp.SMTPSendFailedException: 354 * * at * com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388) * at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1215) at * com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:586) */
}
呵呵, 现在就可以发送Email了.
最后提醒一下,记得要将:activation.jar 和 mail.jar 两个包导入到工程
如何用Spring来发邮件
先来看看发送Email吧, 在Spring中发送Email是很简单的,使用Spring提高的MailSender和MailMessage就可以了,配置代码如下:
?xml version="1.0" encoding="UTF-8"?
!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "spring-beans.dtd"
beans
bean id="mailSender" class="0a1e-4647-3240-31b0 org.springframework.mail.javamail.JavaMailSenderImpl"
property name="host"
valuesmtp.163.com/value
/property
property name="javaMailProperties"
props
!-- 如果要使用用户名和密码验证,这一步需要 --
prop key="mail.smtp.auth"true/prop
/props
/property
property name="username"
value你的Email地址/value
/property
property name="password"
value你的Email密码/value
/property
/bean
!-- 简单的message --
bean id="mailMessage" class="3ee4-1fb2-c695-a222 org.springframework.mail.SimpleMailMessage"
property name="to"
value收件人地址/value
/property
property name="from"
value你的地址/value
/property
property name="subject" !-- Email 标题 --
valueA Spring Mail sender/value
/property
/bean
!-- 测试发送的类 --
bean id="testMailSender" class="1fb2-c695-a222-d779 test.mail.TestSenderMail"
property name="mailMessage"
ref bean="mailMessage"/
/property
property name="mailSender"
ref bean="mailSender"/
/property
/bean
/beans
上面的配置好以后就可以直接发送了, 看看TestSenderMail.java的代码:
package test.mail;
import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
public class TestSenderMail {
private MailSender mailSender;
private SimpleMailMessage mailMessage;
public TestSenderMail() { }
public SimpleMailMessage getMailMessage() {
return mailMessage; }
public void setMailMessage(SimpleMailMessage mailMessage) {
this.mailMessage = mailMessage; }
public MailSender getMailSender() {
return mailSender; }
public void setMailSender(MailSender mailSender) {
this.mailSender = mailSender; }
public void sendMail() {
SimpleMailMessage message = new SimpleMailMessage(mailMessage); //设置email内容,
message.setText("测试Spring 发送Email.");
try {
mailSender.send(message);
} catch (MailException e) {
System.out.println("O . 发送Email失败了....");
e.printStackTrace();
}
}
}
很简单吧. 下面是测试类: TestApp.java
package test.mail;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestApp {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext( "test/mail/mail.xml");
TestSenderMail sender = (TestSenderMail) context .getBean("testMailSender");
sender.sendMail();
}
//抛出如下异常,是瑞星监控的问题,关闭就可以了
/** * DEBUG SMTP: QUIT failed with 250 O . 发送Email失败了....
* org.springframework.mail.MailSendException: Could not send mails: 354
* * com.sun.mail.smtp.SMTPSendFailedException: 354 * * at * com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388) * at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1215) at * com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:586) */
}
呵呵, 现在就可以发送Email了.
最后提醒一下,记得要将:activation.jar 和 mail.jar 两个包导入到工程
spring配置发送邮件的问题
配置的问题,在spring配置文件中,如果是qq邮箱的话,host的值为smtp.qq.com,username要加上@qq.com的后缀。
在代码里面message.setTo("收件箱的邮箱名");肯定有@XX.com格式的字符,message.setFrom 也是
springboot用163邮箱、阿里云企业邮箱发送邮件的配置
springboot+JavaMail用163和阿里云企业邮箱的smtp服务都可以发送邮件,区别在于发送人的邮箱地址。用163免费邮箱,收件人看到的发件邮箱是XXX@163.com,用阿里云企业邮箱可以用自己的域名,例如account@mydomain.com。当然,也可以用其它的免费企业邮箱。
前期准备工作做个简单描述。
去阿里云申请免费企业邮箱
建邮箱账号
下面正式开始
端口:163用25,阿里云企业邮箱用587
password:163用授权码,阿里云企业邮箱用邮箱账号密码
starttls.enable、starttls.required:163配置true,阿里云企业邮箱配置false
中文别名的格式:中文别名邮箱地址,例如:打字狗通行证account@dazigo.vip
想练打字的朋友可以去我的网站:打字狗(dazigo.vip) 在线练习打字
{ } public SimpleMailMessage getMailMessage() { return mailMessage; } public void setMailMessage(SimpleM
e = new SimpleMailMessage(mailMessage); //设置email内容, message.setText("测试Spring 发送Email."); try { mailSender.send(messag
ail sender/value /property /bean !-- 测试发送的类 -- bean id="testMailSender" class="f62a-e258-e86a-c4a2 test.mail.TestSenderMail" property name="m