在我的应用程序中,我使用 spring 发送邮件。当我从任何 gmail id 发送邮件时,它工作正常,但是当我从另一个 smtp 服务器发送邮件时,邮件不会发送。我的gmail弹簧配置:
<beans>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com" />
<property name="port" value="587" />
<property name="username" value="diganta.XXXXX@gmail.com" />
<property name="password" value="******" />
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>
</bean>
<bean id="requestToAcceptOrDeny" class="com.edfx.adb.mail.RequestToAcceptOrDeny">
<property name="mailSender" ref="mailSender" />
</bean>
</beans>
但是当我将配置更改为:
<property name="host" value="mail.mycompany.co.in" />
<property name="port" value="25" />
<property name="username" value="XXX@mycompany.co.in" />
<property name="password" value="abc123" />
那么没有异常正在生成,但邮件也没有发送,密码也没有检查,即给定的密码是否正确。我不明白我在哪里做错了。
谁能帮我?谢谢
更新 1
16:29:23,524 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Hibernate: select user0_.ID as ID7_0_, user0_.CREATE_TIMESTAMP as CREATE2_7_0_, user0_.LAST_UPDATE_TIMESTAMP as LAST3_7_0_, user0_.VERSION as VERSION7_0_, user0_.ACTIVE as ACTIVE7_0_, user0_.DATE_OF_BIRTH as DATE6_7_0_, user0_.DATE_OF_JOINING as DATE7_7_0_, user0_.DATE_OF_RELEASE as DATE8_7_0_, user0_.FIRST_NAME as FIRST9_7_0_, user0_.FULL_NAME as FULL10_7_0_, user0_.HOME_PHONE as HOME11_7_0_, user0_.HOME_POSTAL_ADDRESS as HOME12_7_0_, user0_.LAST_NAME as LAST13_7_0_, user0_.MAIL as MAIL7_0_, user0_.MOBILE as MOBILE7_0_, user0_.ROLE as ROLE7_0_, user0_.USERNAME as USERNAME7_0_ from USER user0_ where user0_.ID=?
16:29:23,534 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: JavaMail version 1.4.4
16:29:23,534 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
16:29:23,544 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: Tables of loaded providers
16:29:23,544 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
16:29:23,544 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
16:29:23,544 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
16:29:23,594 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Sending email ....
16:29:23,594 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
16:29:23,604 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: useEhlo true, useAuth true
16:29:23,604 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: trying to connect to host "mail.mycompany.co.in", port 25, isSSL false
16:29:24,634 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 220 mail.mycompany.co.in ESMTP Postfix
16:29:24,644 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: connected to host "mail.mycompany.co.in", port: 25
16:29:24,644 INFO [stdout] (http-localhost-127.0.0.1-8080-1)
16:29:24,644 INFO [stdout] (http-localhost-127.0.0.1-8080-1) EHLO EDFX-DESKTOP-28
16:29:24,865 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-mail.mycompany.co.in
16:29:24,865 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-PIPELINING
16:29:24,865 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-SIZE 10240000
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-VRFY
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-ETRN
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-ENHANCEDSTATUSCODES
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250-8BITMIME
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250 DSN
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "PIPELINING", arg ""
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "SIZE", arg "10240000"
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "VRFY", arg ""
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "ETRN", arg ""
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "8BITMIME", arg ""
16:29:24,875 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Found extension "DSN", arg ""
16:29:24,895 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: use8bit false
16:29:24,895 INFO [stdout] (http-localhost-127.0.0.1-8080-1) MAIL FROM:<Temp@EDFX-DESKTOP-28>
16:29:25,135 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250 2.1.0 Ok
16:29:25,135 INFO [stdout] (http-localhost-127.0.0.1-8080-1) RCPT TO:<diganta.xxx@gmail.com>
16:29:25,365 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250 2.1.5 Ok
16:29:25,365 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: Verified Addresses
16:29:25,365 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DEBUG SMTP: diganta.xxxx@gmail.com
16:29:25,365 INFO [stdout] (http-localhost-127.0.0.1-8080-1) DATA
16:29:25,615 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 354 End data with <CR><LF>.<CR><LF>
16:29:25,615 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Date: Fri, 3 May 2013 16:29:24 +0530 (IST)
16:29:25,615 INFO [stdout] (http-localhost-127.0.0.1-8080-1) To: diganta.xxxx@gmail.com
16:29:25,615 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Message-ID: <628313650.2.1367578764895.JavaMail.Temp@EDFX-DESKTOP-28>
16:29:25,615 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Subject: Request to Remove Rounak Dey's Activity's Manager privilege from
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) activity EFXL13001
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) MIME-Version: 1.0
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Content-Type: multipart/mixed;
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) boundary="----=_Part_0_263230409.1367578763564"
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1)
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ------=_Part_0_263230409.1367578763564
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Content-Type: multipart/related;
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) boundary="----=_Part_1_1514490209.1367578763584"
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1)
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ------=_Part_1_1514490209.1367578763584
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Content-Type: text/html; charset=us-ascii
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Content-Transfer-Encoding: 7bit
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1)
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) <html><body><a href=http://localhost:8080/ActivityDatabase/req/AcceptOrDenyPermision.xhtml?activityId=EFXL13001&uniqueId=7fe18301-0bde-48da-a7d1-2bbe43b95e98&emailId=diganta.xxxx@gmail.com>Accept Or Deny request..</a></body></html>
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ------=_Part_1_1514490209.1367578763584--
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1)
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ------=_Part_0_263230409.1367578763564--
16:29:25,625 INFO [stdout] (http-localhost-127.0.0.1-8080-1) .
16:29:25,855 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 250 2.0.0 Ok: queued as 164B322AB7
16:29:25,855 INFO [stdout] (http-localhost-127.0.0.1-8080-1) QUIT
16:29:26,046 INFO [stdout] (http-localhost-127.0.0.1-8080-1) 221 2.0.0 Bye