Announcement

Collapse
No announcement yet.

Pb_email correction in SmtpSendMail

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

  • Pb_email correction in SmtpSendMail

    http://www.greatwebdivide.com/software_ddsmtp.htm

    pb_email.bas
    Code:
    FUNCTION SmtpSendMail(  BYVAL hProg AS LONG, _
                            BYVAL SmtpHost AS STRING, BYVAL EmailFrom AS STRING, _
                            BYVAL sEmailTo AS STRING, BYVAL Subject AS STRING, _
                            Message() AS STRING, BYVAL iBlind AS LONG ) AS LONG 
    .    
    .
    .
     
     
     '- Send the recipients
       FOR i = 1 TO iTo
          IF TRIM$(sTo(i)) <> "" THEN
             REM sendLine hTCP, "RCPT TO:" +   sTo(i) + "<" & sTo(i) & ">"   'error 500
             sendLine hTCP,     "RCPT TO:<" +  sTo(i) + ">"
             TCP LINE INPUT #hTCP, Buffer
             e = buffer_status(Buffer)
             IF e <> %PBEMAIL_200 THEN
                GOTO SmtpSendMail_Done
             END IF
          END IF
       NEXT i
    'Added this to demonstrate the call
    FUNCTION PBMAIN AS LONG
      LOCAL hProg AS LONG
      LOCAL SmtpHost AS STRING
      LOCAL EmailFrom AS STRING
      LOCAL EmailTo AS STRING
      LOCAL Subject AS STRING
      REDIM Message(0 TO 10) AS STRING
      LOCAL iBlind AS LONG
      LOCAL Result AS LONG
      SmtpHost   = "smtp.my.central.net"
      EmailFrom  = "[EMAIL="[email protected]"][email protected][/EMAIL]"
      EmailTo    = "[EMAIL="[email protected];[email protected]"][email protected];[email protected][/EMAIL]"
      Subject    = "this is the subject"
      Message(0) = "this is the message"
      iBlind     = 0
     
      result = SmtpSendMail(hProg,         _
                            SmtpHost,      _
                            EmailFrom,     _
                            EmailTo,       _
                            Subject,       _
                            Message(),     _
                            iBlind)
     
      ?  STR$(result)
    END FUNCTION
    Last edited by Mike Doty; 29 Feb 2008, 10:27 AM.
Working...
X