Alaska Software Inc. - SMTP Server
Username: Password:
AuthorTopic: SMTP Server
Phil Ide
SMTP Server
on Thu, 12 Aug 2004 11:13:12 +0100
Has anyone written an SMTP server using ASINET?

I have a need for a simple one that manages a single mailbox and accepts
only plain text messages.  I need this to recieve mails from the UPS when
the status changes, so I can send SMS messages to my mobile.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Growing old is mandatory; growing up is optional.
Thomas Braun Re: SMTP Server
on Thu, 12 Aug 2004 14:30:43 +0200
Phil Ide wrote:

> Has anyone written an SMTP server using ASINET?
> 
> I have a need for a simple one that manages a single mailbox and accepts
> only plain text messages.  I need this to recieve mails from the UPS when
> the status changes, so I can send SMS messages to my mobile.

I would use the Hamster mailserver and do the SMS processing with a Hamster
script. (Hamster can do DLLCalls, so this should be no big thing)

Thomas Braun
Phil Ide
Re: SMTP Server
on Thu, 12 Aug 2004 14:05:50 +0100
Thomas,

>> Has anyone written an SMTP server using ASINET?
>> 
>> I have a need for a simple one that manages a single mailbox and accepts
>> only plain text messages.  I need this to recieve mails from the UPS when
>> the status changes, so I can send SMS messages to my mobile.
> 
> I would use the Hamster mailserver and do the SMS processing with a Hamster
> script. (Hamster can do DLLCalls, so this should be no big thing)

Hmmm, interesting idea.  I'll look into it, thanks!

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

A .45 beats a royal flush EVERY TIME
Anand GuptaRe: SMTP Server
on Fri, 13 Aug 2004 14:38:53 +0530
How about fetching information from UPS via HTTP/POP3 for inbound thing.
    To send out SMS, either use a web-based Service (and make a HTTP/post
call) or simple connect a cellphone attached to your machine, open the port,
and write back AT strings to generate an SMS (you can try Pritpal's VouchSMS
too)

Anand

"Phil Ide" <phil@idep.org.uk> wrote in message
news:teal6b4v19vm$.dlg@idep.org.uk...
> Has anyone written an SMTP server using ASINET?
>
> I have a need for a simple one that manages a single mailbox and accepts
> only plain text messages.  I need this to recieve mails from the UPS when
> the status changes, so I can send SMS messages to my mobile.
>
> Regards,
> --
Phil Ide
Re: SMTP Server
on Fri, 13 Aug 2004 16:22:54 +0100
Anand,

> How about fetching information from UPS via HTTP/POP3 for inbound thing.
>     To send out SMS, either use a web-based Service (and make a HTTP/post
> call) or simple connect a cellphone attached to your machine, open the port,
> and write back AT strings to generate an SMS (you can try Pritpal's VouchSMS
> too)

I already have an SMS service, and even wriiten the Xbase++ software to
send the messages.  The UPS sends alerts via email, so if I had a simple
SMTP service to act as a server, then I could point the UPS at it.  As soon
as a mail arrives, I can deliver the appropriate SMS messages.  I could
also get the UPS to deliver mail to our mail-server, but that would mean
either monitoring a mailbox, or setting up a trigger on the box.  The SMTP
service is quite simply the most elegant, controllable and responsive way
to handle the problem.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Sector not found. Kill Program? (Y)es, (N)o, (S)crew it
Anand GuptaRe: SMTP Server
on Sat, 14 Aug 2004 11:25:32 +0530
Hi Phil

True. I was looking at your requirement the other way round 

Anand

NB: Could you point me to the SMS Service, you using ?

"Phil Ide" <phil@idep.org.uk> wrote in message
news:vqedmcobg26h.dlg@idep.org.uk...
> Anand,
>
> > How about fetching information from UPS via HTTP/POP3 for inbound thing.
> >     To send out SMS, either use a web-based Service (and make a
HTTP/post
> > call) or simple connect a cellphone attached to your machine, open the
port,
<snip>
Phil Ide
Re: SMTP Server
on Mon, 16 Aug 2004 11:29:01 +0100
Anand,

> NB: Could you point me to the SMS Service, you using ?

http://ws.textanywhere.net/web/home/

The code to send a message is:

      cUrl := scUrl
      cData := 'Client_ID='+scClientID+'&'+;
              'Client_Pass='+scClientPass+'&'+;
              'Client_Ref='+cMsgID+'&'+;
              'Billing_Ref='+cMsgID+'&'+;
              'Connection=2&'+;
              'Originator=MORGOTH&'+;  computer name
              'OType=1&'+;
              'DestinationEx='+scDestList+'&'+;
              'Body='+cMsg+'&'+;
              'SMS_Type=1&'+;
              'Reply_Type=0&'+;
              'Reply_Data='

      cData := StrTran(cData, CRLF, '%0d%0a' )
      cData := StrTran(cData, ' ', '%20' )
      cData := StrTran(cData, '+', '%2b' )

      if slSendSMS
         cResp := LoadFromUrl(cUrl,,,,,'POST',cData)
      else
         cResp := 'SMS Disabled'
      endif

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Make headlines!  Use a cordoroy pillow!
Anand GuptaRe: SMTP Server
on Tue, 17 Aug 2004 10:52:49 +0530
Hi Phil

This looks abs simple to implement.
Thanks

Anand

"Phil Ide" <phil@idep.org.uk> wrote in message
news:1nya9y5c4kafl$.dlg@idep.org.uk...
> Anand,
>
> > NB: Could you point me to the SMS Service, you using ?
>
> http://ws.textanywhere.net/web/home/
>
<snip>
Phil Ide
Re: SMTP Server
on Tue, 17 Aug 2004 09:27:56 +0100
Anand,

> This looks abs simple to implement.
> Thanks

It was 

I also tried connecting to their SOAP server using Xb2.NET, but this was
unsuccessful.  The problem is, they expect you to use Microsoft's SOAP SDK
(also used by Delphi), which in turn relies on WSDL docs.  Until Xb2.NET
also has a function which generates dynamic classes based on WSDL, this is
a bit of a problem.

It's an interesting technical problem, and I'd love to have a crack but
don't have the time, so I guess I'll just have to wait until Boris gives us
the solution 

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

All wiyht. Rho sritched mg kegtops awound?
Anand GuptaRe: SMTP Server
on Wed, 18 Aug 2004 15:05:54 +0530
Hi Phil

Ahh whilst seeing the site, it did came to mind, as they have mentioned the
support for SOAP as well.
However, currently what am looking for is a simple HTTP request thing (but
yeah the client might need to worry for his username/password, as they will
be travelling across their network, unEncrypted)

Anand

"Phil Ide" <phil@idep.org.uk> wrote in message
news:f720tnup8jb.dlg@idep.org.uk...
> Anand,
>
> > This looks abs simple to implement.
> > Thanks
>
> It was 
>
> I also tried connecting to their SOAP server using Xb2.NET, but this was
> unsuccessful.  The problem is, they expect you to use Microsoft's SOAP SDK
> (also used by Delphi), which in turn relies on WSDL docs.  Until Xb2.NET
> also has a function which generates dynamic classes based on WSDL, this is
> a bit of a problem.
>
> It's an interesting technical problem, and I'd love to have a crack but
<snip>
Phil Ide
Re: SMTP Server
on Wed, 18 Aug 2004 11:13:42 +0100
Anand,

> Ahh whilst seeing the site, it did came to mind, as they have mentioned the
> support for SOAP as well.
> However, currently what am looking for is a simple HTTP request thing (but
> yeah the client might need to worry for his username/password, as they will
> be travelling across their network, unEncrypted)

Relax, take a look at the url you send the message to:

url=https://ws.textanywhere.net/HTTPRX/SendSMSEx.aspx

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Every sperm is Sacred!
Anand GuptaRe: SMTP Server
on Thu, 19 Aug 2004 11:04:19 +0530
Hi Phil

A query here, will a LoadFromURL() work with this ?
<snip>

> Relax, take a look at the url you send the message to:
>
> url=https://ws.textanywhere.net/HTTPRX/SendSMSEx.aspx

Anand
Phil Ide
Re: SMTP Server
on Thu, 19 Aug 2004 09:12:59 +0100
Anand,

> A query here, will a LoadFromURL() work with this ?
> <snip>
> 
>> Relax, take a look at the url you send the message to:
>>
>> url=https://ws.textanywhere.net/HTTPRX/SendSMSEx.aspx

You mean will it work with HTTPS?  Yes.  In fact the code I published here
was from a working application.  The application uses the WinAPI to test
the state of the battery, it's charge level and condition, and sends an SMS
message when:

  o AC Power goes off/online
  o Battery status changes (disharging/charging)
  o Battery condition changes (high, low, critical)
  o Every 10% raise/drop in the battery charge

Unforunately, it appears that whilst the WinAPI routines work well with
laptop batteries, they do not work with APC UPS's.  Hence I have to
receive messages from the UPS via email - hence I want to monitor a
mailbox.

If you want to take a look at the code which works for a laptop (actually,
it works with all batteries except UPS's (duh!)), I'll gladly make it
available.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Tug tunic - the Patrick Stewart Maneuver
Anand GuptaRe: SMTP Server
on Thu, 19 Aug 2004 15:33:21 +0530
Hi Phil

Yep I wasnt sure, if ASINET LoadFromURL() requests to HTTPS would work or
not. (Realised that the header file does allows to pass if its a HTTP or
HTTPS server).

Well, we all learn from and others code's published here, on ACSN or on your
site.

Anand

NB: RK was referring for some sample he gave me to compile sometime ago. Any
further luck on that ?

"Phil Ide" <phil@idep.org.uk> wrote in message
news:1kpnch7dn2f3.dlg@idep.org.uk...
> Anand,
>
> > A query here, will a LoadFromURL() work with this ?
> > <snip>
> >
<snip>
Phil Ide
Re: SMTP Server
on Thu, 19 Aug 2004 12:09:49 +0100
Anand,

> NB: RK was referring for some sample he gave me to compile sometime ago. Any
> further luck on that ?

LoadFromUrl2() ?

The status of this is that it can handle proxies now, but only manually -
i.e. you have to pass the proxy parameters:

LoadFromUrl2( cUrl, nPort, cProxyUrl, acBypass, cMethod, cPostString )

...where cProxyUrl becomes mandatory when you wish to use a proxy (acBypass
becomes mandatory if cUrl might be in the bypass list).

The WinAPI functions I discovered will discover both proxy settings and
registered bypass addresses automatically, but I haven't got around to
coding it yet.  Perhaps on Monday or Tueday I'll get a chance.

I also intend to enhance LoadFromUrl2() so that you can pass an additional
parameter which contains additional/replacement http headers.  Where any of
the headers do not exist, they are added.  Where they already exist, they
will be replaced by the passed string.  This is of course subject to
overrides - for example, if you supply a "Content-Length:" header, then
that will automatically be discarded because the routine will supply it's
own (validated) header.

Additionally, there will be an additional function which will allow you to
pre-set default headers.  For example, if you wish to masquerade as
Internet Explorer on a Windows/XP machine, you could set a default header
as:

(this is one line)

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
1.1.4322)

By calling a function to pre-set this, you won't be forced to add it to all
LoadFromUrl2() calls.

The reason why I started this (if someone missed it) is because I was
trying to do a LoadFromUrl() from an agency we have recently engaged to
allow us to do credit checks.  Imagine my surprise when their cr*ppy web
site returned a message saying "You must use Internet Explorer to use this
site".  To get around this, I simply needed to add the above User-Agent
header to fool the system into giving me the page.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Don't just DO something, STAND THERE!
Anand GuptaRe: SMTP Server
on Thu, 19 Aug 2004 19:25:38 +0530
Hi Phil

Yep LoadFromURL2(). We were planning to check it out for several things, we
have been planning for.
Where can I check for the update ? Couldnt locate on your website either.

Anand


"Phil Ide" <phil@idep.org.uk> wrote in message
news:9k5to90f0gex.dlg@idep.org.uk...
> Anand,
>
> LoadFromUrl2() ?
>
> The status of this is that it can handle proxies now, but only manually -
> i.e. you have to pass the proxy parameters:
>
> LoadFromUrl2( cUrl, nPort, cProxyUrl, acBypass, cMethod, cPostString )
>
> ...where cProxyUrl becomes mandatory when you wish to use a proxy
(acBypass
> becomes mandatory if cUrl might be in the bypass list).
>
> The WinAPI functions I discovered will discover both proxy settings and
> registered bypass addresses automatically, but I haven't got around to
> coding it yet.  Perhaps on Monday or Tueday I'll get a chance.
<snip>
Phil Ide
Re: SMTP Server
on Thu, 19 Aug 2004 14:57:00 +0100
Anand,

Aren't you in luck?

> The WinAPI functions I discovered will discover both proxy settings and
> registered bypass addresses automatically, but I haven't got around to
> coding it yet.  Perhaps on Monday or Tueday I'll get a chance.

I had to return to this just now, and I got it working so it now picks up
the proxy and bypass data automagically.  You also don't need ASINET 

All I have to do now is make it parameter-compatible with LoadFromUrl() and
I'll release it.

I've included the ability to pass additional/replacement headers in the
parameter list, and to pre-set default additional parameters.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Entomology: I fear no weevil.
Anand GuptaRe: SMTP Server
on Fri, 20 Aug 2004 11:51:55 +0530
Hi Phil

> I had to return to this just now, and I got it working so it now picks up
> the proxy and bypass data automagically.  You also don't need ASINET 
Cool lot many people will be able to take advantage of it now.
>
> All I have to do now is make it parameter-compatible with LoadFromUrl()
and
> I'll release it.
Sensible, all existing LoadFromURL() users' can straightaway use it.
Probably one could just overload the LoadFromURL() function itself...

> I've included the ability to pass additional/replacement headers in the
> parameter list, and to pre-set default additional parameters.
There is always a room for more... 

All the best once again Phil.

Anand
Phil Ide
Re: SMTP Server
on Fri, 20 Aug 2004 09:15:29 +0100
Anand,

>> I've included the ability to pass additional/replacement headers in the
>> parameter list, and to pre-set default additional parameters.
> There is always a room for more... 
> 
> All the best once again Phil.

I got bored last night - the only thing on tv was the Olympics, so I
knuckled down and re-wrote it.

It appears to be working fine, but I don't have a proxy to test against.
I'll send you a copy and you can give me the thumbs up/down.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

System error - press F13 to continue.
Anand GuptaRe: SMTP Server
on Sat, 21 Aug 2004 11:35:04 +0530
Great. I will await for the same.

Anand

NB : We are upgrading our webserver from an old IBM/P4/server to
Dell/Xeon/dual processor. RK has left for Delhi for the same, as we have our
webserver co-located out there... Should be fun with Red Hat ES 3.0 on the
same.


"Phil Ide" <phil@idep.org.uk> wrote in message
news:1gbrhqh59wntq$.dlg@idep.org.uk...
> Anand,
>
> >> I've included the ability to pass additional/replacement headers in the
> >> parameter list, and to pre-set default additional parameters.
> > There is always a room for more... 
> >
> > All the best once again Phil.
>
> I got bored last night - the only thing on tv was the Olympics, so I
> knuckled down and re-wrote it.
>
> It appears to be working fine, but I don't have a proxy to test against.
> I'll send you a copy and you can give me the thumbs up/down.
>
> Regards,
> --
> Phil Ide