小编San*_* K.的帖子

通过JavaMail API发送邮件时无法连接到SMTP主机异常

我正在尝试使用JavaMail API向Gmail帐户发送电子邮件.我已经完成了以下代码.我想将邮件发送到多个配方.但是它无法正常工作.它给出了一个例外,例如"无法连接到SMTP主机.发送失败"

package com.cts.email;

import java.util.Properties;


import javax.mail.Message; 
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport; 
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class SendEmail {     
      Properties emailProperties;  
      Session mailSession;
      MimeMessage emailMessage;   
      public static void main(String args[]) throws MessagingException, javax.mail.MessagingException {      
            SendEmail javaEmail = new SendEmail();  
            Session session=javaEmail.setMailServerProperties();   
            javaEmail.createEmailMessage(session);  
          //  javaEmail.sendEmail(); 
            }    
      public Session setMailServerProperties() {    
          Properties props = new Properties();
        props.put("mail.smtp.host", "smtp.gmail.com");
        props.put("mail.smtp.socketFactory.port", "465");
        props.put("mail.smtp.socketFactory.class",
                "javax.net.ssl.SSLSocketFactory");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.port", "465");

        Session session = Session.getDefaultInstance(props,
            new javax.mail.Authenticator() {
                protected PasswordAuthentication getPasswordAuthentication() { …
Run Code Online (Sandbox Code Playgroud)

java jakarta-mail

11
推荐指数
1
解决办法
4万
查看次数

在谷歌图表中,图例指示符颜色不会随条形颜色而变化

我正在使用Google图表.我想改变图表中的条形颜色.所以使用系列风格我改变了条形颜色.但同时我想根据条形颜色更改Legend指示灯颜色.但我无法更改图例指示灯颜色.请帮我.

这是图表代码:

 google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart3);
      function drawChart3() {
          var data = google.visualization.arrayToDataTable([
            ['Priority', 'Resolution(%)',{ role: 'annotation' },'ESL(%)',{ role: 'annotation' },{ role: 'style' }],
            ['P1', <%=P1_PERCENT %>,<%=P1_PERCENT%>,95,95,'color: #fcb441' ],
            ['P2', <%=P2_PERCENT%>,<%=P2_PERCENT%>,95,95,'color: #fcb441' ],
            ['P3 & P4', <%=P3_P4_PERCENT%>,<%=P3_P4_PERCENT%>,90,90,'color: #fcb441' ]
            ]);

        var options = {
          tooltip:{textStyle:{fontName:'"Arial"'}},
          title: 'Resolution(Priority Wise)',titleTextStyle:{fontName:'"Arial"'},
          hAxis: {title: 'Priority', titleTextStyle: {color: 'black',fontSize:'15',fontName:'"Arial"'}},
          vAxis: {minValue:0},
          legend:{position: 'bottom'},
          chartArea:{width:'88%'}
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('g4'));
        chart.draw(data, options);
      }
Run Code Online (Sandbox Code Playgroud)

我得到这样的图表

结果图表

google-visualization

10
推荐指数
1
解决办法
1万
查看次数

ORA-06502:PL/SQL:数字或值错误:C#代码中的字符串缓冲区太小异常

我试图用asp.net上的#code中的in和out参数执行一些oracle pl/sql过程.我想从out参数中检索值.但是当我执行时,我得到一个oracle异常,如"ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小".我现在可以做什么?请帮我.

码:

using Oracle.DataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Activity.Account
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SuccessLabel.Visible = false;
            FailureLabel.Visible = false;
        }

        protected void Create_user(object sender, EventArgs e)
        {
            var id="";
            string oradb = "Data Source=OracleServerHost;User ID=scott;password=tiger";
            using (OracleConnection conn = new OracleConnection(oradb))
            {
                try
                {
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection = conn;
                    cmd.CommandText = "create_users_372640"; …
Run Code Online (Sandbox Code Playgroud)

c# asp.net oracle plsql

9
推荐指数
2
解决办法
4万
查看次数

在c#中将日期格式从mm-dd-yyyy转换为dd-mmm-yyyy

我正在尝试将asp.net表单字段值插入到oracle数据库表中.我有一个日期字段,格式为"MM-DD-YYYY".我需要将该日期添加到oracle表.所以我试图将该日期格式转换为"DD-MMM-YYYY"格式.但我收到以下错误.

码:

var creation_date = DateTime.ParseExact(CreationDateTextBox.Text, "DD-MMM-YYYY",null);
Run Code Online (Sandbox Code Playgroud)

文本框值是:12-12-2013.(没时间)我收到错误,如"字符串未被识别为有效的DateTime".

c# asp.net date

1
推荐指数
2
解决办法
6万
查看次数

在ColdFusion中调用函数时,"对象预期"错误JavaScript

我是ColdFusion的新手.我正在尝试编写一个JavaScript函数来禁用基于单选按钮值的文本框.但是我在调​​用JavaScript函数时遇到"对象期望"错误.请帮我解决这个问题.

<cfscript>
  function validate(){
    alert('hi');
    if(document.report_outage.bkp_dec.checked == true){
      document.report_outage.clbkp_phn.disabled=false;
    }
    else{
      document.report_outage.clbkp_phn.disabled=true;
    }
  }
</cfscript>
<cfset bkp_dec = "Yes,No">

<cfform name="report_outage">
<cfloop list="#bkp_dec#" index="listElement" delimiters=",">
  <cfinput type="radio" name="bkp_dec" value="#listElement#" onclick="validate();"/> <cfoutput>#listElement#</cfoutput> <br>
</cfloop>
<cfinput type="text" name="clbkp_phn" id="clbkp_phn" value=""/>
</cfform>
Run Code Online (Sandbox Code Playgroud)

javascript coldfusion

0
推荐指数
1
解决办法
728
查看次数