Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Using GMAIL server for email with SVAIREMAIL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using GMAIL server for email with SVAIREMAIL

    Tom,

    I am trying to run Javamail_Hello world program and am getting "javax.mail.MessagingException: Could not connect to
    TransportSend Error " error.

    My inputs are as follows:
    //main pgm
    msg = AirEmail_newMessage('myusername':'mypwd');


    //service pgm

    D svDefaultHost C CONST('gmail.com')

    '
    '
    svHost = svDefaultHost;
    '
    '
    // Host: URL Location of the SMTP server
    svPropKey = new_String('mail.host');
    svPropValue = new_String(%trim(svHost));
    Properties_setProperty(svProp: svPropKey: svPropValue);


    // LocalHost: Required or HELO will fail
    svPropKey = new_String('mail.smtp.host');
    svPropValue = new_String('smtp.gmail.com');
    Properties_setProperty(svProp: svPropKey: svPropValue);

    The reason I am using gmail server is that I am unaware of my companies mail servers url&host name.
    I have pinged gmail.com from my IBM i and it succeeds(I can access gmail from my company network). I added couple of properties by referring
    http://www.mkyong.com/java/javamail-...-smtp-example/ to our service program but it still fails.

    Could you please tell what I am doing wrong? and what is the difference between mail.smtp.host and mail.host
    properties exactly??

    Sorry to bother you,

    -David

  • #2
    Hi David,

    Sorry I couldn't get back to you sooner. Gmail uses SSL, so you have to set some additional properties as follows:


    //-----------------------------------------------------------------
    // NEW SSL SPECIFIC PROPERTY SETTINGS
    //-----------------------------------------------------------------
    // Port: gmail typically uses 465
    svPropKey = new_String('mail.smtp.port');
    svPropValue = new_String('465');
    Properties_setProperty(svProp: svPropKey: svPropValue);
    // Auth: Set to True (Notice the 's' in smtps)
    svPropKey = new_String('mail.smtps.auth');
    svPropValue = new_String('true');
    Properties_setProperty(svProp: svPropKey: svPropValue);
    // starttlset.enable: Start TLS, which is the newer version of SSL
    svPropKey = new_String('mail.smtp.starttls.enable');
    svPropValue = new_String('true');
    Properties_setProperty(svProp: svPropKey: svPropValue);


    Let me know if this works for you. Unfortunately I am really bogged down this month, but I'll try to get back to you when I can.

    Tom

    Comment


    • #3
      Thank you Tom, for taking time out from your busy schedule and replying to my query.
      Well the good news I have is I did find out my companies Mail server's url and could successfully run the Hello world email program.

      Coming back to using GMAIL server, I added the properties you gave me, it still doesnt work. Following is the error that is written to my joblog ( I am writing the error message to my joblog using an C API).

      javax.mail.MessagingException: Could not connect to SMTP host:
      smtp.gmail.com, port: 465; nested exception
      is:java.net.ConnectException: A remote host refused an attempted
      connect operation.

      I am not very sure what the exact values my 'mail.host' and 'mail.smtp.host' properties should have / and what they are meant for, but I am using " smtp.gmail.com" for both of them.

      I am researching on this error, I tried by adding some more properties I found in some posts on web, but it still fails. Well let me keep trying.
      You may take a look at it when you are less busy(I am sure you will be busy most of your time after this awesome book!!! :-) )
      Thanks as always.
      David
      Last edited by Guest.Visitor; 08-04-2010, 06:42 AM. Reason: Added a sentence

      Comment

      Working...
      X