Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #5951 > unrolled thread

Re: Sending email with default prog

Started by"Heli-Team.pl Portal" <admin1@heli-team.pl>
First post2011-01-28 02:29 -0800
Last post2011-01-28 08:48 -0600
Articles 2 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Sending email with default prog "Heli-Team.pl Portal" <admin1@heli-team.pl> - 2011-01-28 02:29 -0800
    Re: Sending email with default prog "Willie Moore" <williem@wmconsulting.com> - 2011-01-28 08:48 -0600

#5951 — Re: Sending email with default prog

From"Heli-Team.pl Portal" <admin1@heli-team.pl>
Date2011-01-28 02:29 -0800
SubjectRe: Sending email with default prog
Message-ID<dafb2235-0d5e-4a4b-9883-f0da734c93f7@o7g2000prn.googlegroups.com>
On 27 Sty, 23:08, Stefan L <s...@proffs.org> wrote:
(...)

Thank for code...but unfortunately it doesn't work.

I have modified a little:

----
(...)
IF lLogin
        oSmtp:Username := cUsername
        oSmtp:Password := cPassword

  IF !oSmtp:connect(cServer, 587)  // without Connect, Logon doesn't
work
                              // checked 25, 465 and 587
    RETURN "Can't use port 587"
  ELSE
    cRet:=cRet+'Connected to '+cServer+" , "+cServerIP+CRLF
  END

  IF !oSmtp:Logon()
    RETURN "Can't log in on the SMTP server: "+cServer+" , "+cServerIP
  ELSE
    cRet:=cRet+"Logged to the SMTP server: "+cServer+" , "+cServerIP
+CRLF
  ENDIF

ENDIF
(...)
----
Without :connect there was always "Can't log in ..." but even if it
looked "connected, logged" still didn't work - :SendMail() always
fails.

I have tried ports 25 and 587, normal and secured, with/without logon
and all doesn't work.
Even if it connects and logs on (at least :Connect() and :logon()
return true) the :SendMail fails.

I also tried port 465 (it has been checked in Thunderbird) and it even
doesn't connect.

[toc] | [next] | [standalone]


#5956

From"Willie Moore" <williem@wmconsulting.com>
Date2011-01-28 08:48 -0600
Message-ID<ihukv7$1ho$1@speranza.aioe.org>
In reply to#5951
Gregory,

The attached code is a slightly modified version of Stephan's code. I have 
tested this against VO 2.8 sp3.

Regards,
Willie

FUNCTION Start()
    LOCAL cReturn AS STRING
    ? cReturn := SMTPSendMail("mail.mannersinmotion.com", ;     // My ISP's 
server,
                               "Test to send email", ; 
// Subject
                               "herding@mannersinmotion.com", ; 
// To:
                             "", ; 
// CC:
                            "This is a test for body", ; 
// Body
                               "williem@mannersinmotion.com", ;           // 
From:
                             "c:\world.ico", ; 
// Attached file
                            "Willie Moore", ; 
// My name
                               "", ; 
// BCC:
                               "", ; 
// Cargo
                             "YourLogonInfoGoesHere", ; 
// User name when you need to log IN
                            "YourPwdGoesHere", ; 
// Password when you need to logIN
                            TRUE, ; 
// Log in YES/NO
                               TRUE, ; 
// Log in to a secure server . If you login on most servers this needs to be 
true
                               75; 
// port. pass in 0 to use the default SMTP port
                       )
    WAIT
    RETURN NIL

FUNCTION SMTPSendMail       (cServer      AS STRING,;
     cMailSubject   AS STRING,;
     xDestUser      AS USUAL,;
     xCCUser        AS USUAL,;
     cBody          AS STRING,;
     cFromAddress   AS STRING,;
     xAttachFile    AS USUAL,;
     cFromName      AS STRING,;
     xBCCUser       AS USUAL,;
     cCargo         AS STRING,;
     cUsername      AS STRING,;
     cPassword      AS STRING,;
     lLogin         AS LOGIC,;
     lSecure        AS LOGIC,;
     nPort              AS LONG)   AS STRING PASCAL

        LOCAL cRet AS STRING
        LOCAL oSmtp    AS CSMTP
        LOCAL oEmail   AS CEmail
        LOCAL cServerIP := GetIPAddress(cServer) AS STRING

      oEmail := CEmail{}
      oEmail:FromAddress   := cFromAddress
      oEmail:FromName      := cFromName
      oEmail:Cargo         := cCargo
      oEmail:Subject       := cMailSubject
      oEmail:DestList      := xDestUser
      oEmail:CCList        := xCCUser
      oEmail:BCCList       := xBCCUser
      oEmail:MailBody        := cBody

      IF !IsNil(xAttachFile)
        oEmail:AttachmentFileList := xAttachFile
      ENDIF

      oSmtp := CSMTP{oEmail}
      oSmtp:RemoteHost  := cServerIP
      oSmtp:TimeOut := 5000
      IF nPort > 0
          oSmtp:RemotePort := nPort
      ENDIF
      IF lSecure
        oSmtp:SecureSMTP := TRUE
      ENDIF
      IF lLogin
        oSmtp:Username := cUsername
        oSmtp:Password := cPassword
      ENDIF
      IF oSmtp:SendMail()
        cRet := "Email sent."
      ELSE
        cRet := "Failed to send email."
      ENDIF
      RETURN cRet 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web