使用spring通过http协议发送邮件

时间:2016-12-24 05:29:27

标签: spring http

在我的应用程序中,需要使用spring通过http协议发送邮件。

当我通过http协议发送电子邮件时,收到以下错误。

  Exception in thread "main"  org.springframework.mail.MailSendException:   Mail server connection failed;  nested exception is javax.mail.NoSuchProviderException: No provider for http. Failed messages: javax.mail.NoSuchProviderException: No provider for http; message exception details (1) are:
  Failed message 1:
  javax.mail.NoSuchProviderException: No provider for http


<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="smtp.gmail.com" />
        <property name="port" value="443" />
        <property name="username" value="testuser@gmail.com"/>
        <property name="password" value=<password>/>

          <!-- The name of the property, following JavaBean naming  conventions -->
        <property name="javaMailProperties">
            <props>
                <prop key="mail.transport.protocol">http</prop>
                <prop key="mail.smtp.auth">false</prop>
                <prop key="mail.smtp.starttls.enable">true</prop>
                <prop key="mail.debug">true</prop>
            </props>
        </property>
</bean>

0 个答案:

没有答案