simple libSMTP send example, help
Alex Tweedly
alex at tweedly.net
Sat Aug 21 19:10:57 EDT 2004
At 07:31 21/08/2004 -0700, Mark Brownell wrote:
>Hi,
>
>I'm trying to get libSMTP to work for a basic simple email send.
>
>If I use this to add the libraries with the stacks added to my main stack
>already:
>
>on openStack
> start using stack "libEmail"
> start using stack "libSmtp"
>end openStack
>
>on closeStack
> stop using stack "libEmail"
> stop using stack "libSmtp"
>end closeStack
>
>Then I need a few lines of code to send email to this destination:
>send "ABCDEFG test" to "gizmotron at earthlink.net" with subject "test send"
>
>or
>body = "ABCDEFG test"
>destination = "gizmotron at earthlink.net"
>subject = "test send"
>
>I'm searching for a simple example of using libSmtp to send a plain text
>email. I can't get the example to work from Shoe Sean's website example. I
>think it is because I'm not sure how to use adding destinations and saving
>and/or selecting them during a send. Anyway it crashes on an HTMLtext
>handler. I'm using Rev 2.2 on Mac OSX. Does anyone have a basic email
>stack or example of code using these libraries that sends a single email
>without it being something that looks like it came from the source code of
>a full blown email client?
>
>Having it report that the email was successfully sent looks like it is
>part of the lib also.
Here's about the most basic you can get .... and it worked on only my 200th
try :-)
>on mouseUp
> put "alex at tweedly.net"&cr into mFrom
> put "alex at tweedly.net" & lf & "alex at tweedly.com" & lf into mTo
> put "A simple text message" & cr & "over two lines" into mMessage
> put "smtp.btinternet.com" into mServer
> put "25" into mPort
> put "about to go " after msg
> put libSmtp.send(mFrom, mTo, mMessage, mServer)
> put the result after msg
>end mouseUp
Note - LF to separate the recipients
Note - I think I picked up an old version of the library, so you may need
to change libSmtp.send to libSmtpSend if you have the later one from the
appExample stack
Note - this sends the message to two of my addresses. I did receive both
copies; the one that came via the .com address (which forwards it to the
.net one) looked OK
>Delivered-To: 1000-alex at tweedly.net
>From: alex at tweedly.net
>Bcc:
>Date: Sun, 22 Aug 2004 00:51:55 +0200
>X-Provags-Forward: alex at tweedly.com -> alex at tweedly.net
>
>A simple text message
>over two lines
The one that came "direct" looked bad -
>Delivered-To: 1000-alex at tweedly.net
>
>
>A simple text message
>over two lines
and it had no "Who" (who from) entry in my Eudora inbox summary.
So you should use libEmail to fill in a more complete message.
-- Alex.
More information about the use-livecode
mailing list