jbv wrote/ schreef:

> AFAIR, MC2.3.2 doesn't support SMTP.
That's correct.

> Any better idea ?
I think so: you could build your own SMTP client in MC. It'd be something
like the script below.

You could use it in the stack with the server (and eventual authentication)
already supplied.
 
> Thanks.
> JB
Hope this help,
Sjoerd

BTW In case you wondered: some comments are Dutch, I hadn't time to
translate them.
NOTE: Didn't test this script good, you may have to change things yourself.
BTW 2: As you may know, I have the Starter Kit. I put this script into a
HyperCard stack, converted it to MC, and 'library'ed it to use it.
----- SMTP Script ----
function sendmail 
mToName,mToAddress,mFromName,mFromAddress,mSubject,mBody,mServer
  # declare globals
  global logF
  put empty into logF
  
  ### genereren maildata ###
  put "To: " & mToName && "<" & mToAddress & ">" & cr into data
  put "From: " & mFromname && "<" & mFromAddress & ">" & cr after data
  put "Subject: " & mSubject & cr after data
  put "X-Mailer: cgiLib.mc" && the version && "(" & the platform & ")" & cr
& cr after data
  put mBody & crlf & "." & crlf after data
  schrijfLog "--- data ---" & cr & data & cr & "------------"
  
  ### openen verbinding ###
  put hostnametoaddress(mServer) into serverIP
  put serverIP & ":25" into socketY
  open socket socketY
  read from socket socketY for 1 line
  put it into temp
  schrijfLog "  " & temp
  
  if char 1 to 3 of temp is "220" then
    put hostAddress(socketY) into localIP
    write "HELO " & localIP  & CRLF to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "Server replies..."
  else
    schrijfLog "Server doesn't respond correctly."
  end if
  schrijfLog "  " & temp
  
  if char 1 to 3  of temp is "250" then
    write "RSET"  & CRLF to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "Identity accepted."
  else
    schrijfLog "Identity denied."
  end if
  schrijfLog "  " & temp
  
  if char 1 to 3  of temp is "250" then
    write "MAIL FROM:" && mFromaddress & CRLF to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "RSET succesful"
  else
    schrijfLog "RSET UNsuccesful"
  end if
  schrijfLog "  " & temp
  
  if char 1 to 3  of temp is "250" then
    write "RCPT TO: "& mToAddress & CRLF to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "MAIL FROM: succesful"
  else
    schrijfLog "MAIL FROM: UNsuccesful"
  end if
  schrijfLog "  " & temp
  
  if char 1 to 3  of temp is "250" then
    write "DATA"& CRLF to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "RCPT TO: succesful"
  else
    schrijfLog "RCPT TO: UNsuccesful"
  end if
  schrijfLog "  " & temp
  
  if char 1 to 3 of temp is "354" then
    write data to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "DATA being sent..."
  else
    schrijfLog "DATA NOT being sent"
  end if
  schrijfLog "  " & temp
  
  if char 1 to 3 of temp is "250" then
    write "QUIT"  & CRLF to socket socketY
    read from socket socketY for 1 line
    put it into temp
    schrijfLog "Ready"
  else
    schrijfLog "Not ready"
  end if
  schrijfLog "  " & temp
  
  close socket socketY
  schrijfLog "Socket closed."
  
  if line -4 of logF is "Ready" then
    return "OK"
  else
    return "Error, see log:" & cr & cr & logF
  end if
end sendmail

on schrijfLog tekst
  global logF
  put tekst & cr after logF
end schrijfLog


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to