0
我使用Spring和JavaMailSenderImpl發送電子郵件。但是,當我嘗試發送電子郵件到有特殊字符的電子郵件地址(conceiçã[email protected])我得到以下錯誤:帶有特殊字符的SMTPTransport和電子郵件
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 554 5.1.1 concei [email protected]>: Recipient address rejected: User unknown in local recipient table
org.springframework.mail.MailSendException: Failed messages: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 554 5.1.1 concei [email protected]>:
Recipient address rejected: User unknown in local recipient table
; message exception details (1) are:
Failed message 1:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 554 5.1.1 concei [email protected]>:
Recipient address rejected: User unknown in local recipient table
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1294)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:635)
我JavaMailSenderImpl配置爲:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="defaultEncoding" value="UTF-8" />
<property name="host">
<value>${application.mail.host}</value>
</property>
<property name="port">
<value>${application.mail.port}</value>
</property>
<property name="username">
<value>${application.mail.username}</value>
</property>
<property name="password">
<value>${application.mail.password}</value>
</property>
<property name="javaMailProperties">
<props>
<prop key="mail.mime.charset">UTF-8</prop>
</props>
</property>
</bean>
而且我正在使用MimeMessage。
我錯過了什麼?
編輯:
我認爲這個問題是:
protected void sendCommand(String cmd) throws MessagingException {
sendCommand(ASCIIUtility.getBytes(cmd));
}
代碼發送地址,郵件服務器,但是當它轉換爲字節不必須考慮到非ASCII字符。
因此,使用Spring框架將電子郵件發送到包含特殊字符的地址是不可能的?
郵件地址不是RFC5322定義的有效地址。可能您的郵件服務器不符合RFC6530?請參閱:http://en.wikipedia.org/wiki/Email_address#Internationalization – Durandal 2014-11-14 20:32:51
我不認爲問題是我的郵件服務器,因爲當我通過我的電子郵件帳戶發送電子郵件時,他們收到了該地址。但我去了檢查。 – gomes 2014-11-16 19:26:26