简体   繁体   中英

smtp.gmail.com, port: 587 fails

I'm trying to send mail using java in my web project.E-mail sending is perfectly working in my pc, but when I run it on my office computer,I received following error.

In my applicationcontext.xml

    </bean>
    <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="myemail@gmail.com" />
    <property name="password" value="****" />
    <property name="javaMailProperties">
        <props>
            <prop key="mail.transport.protocol">smtp</prop>
            <prop key="mail.smtp.auth">true</prop>
            <prop key="mail.smtp.starttls.enable">true</prop>
        </props>
    </property>
</bean>

Pls guide me to solve this issue.Thanks

Considering the location perspective, you can first check if your office firewall is allowing you to connect to the target location using the smtp protocol.

For the java perspective, check if your office PC are running at the same java version, binaries and build similar to you home PC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM