NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - seancameron

Pages: [1] 2
Web Server - Ask For Help / Re: SMPP
« on: March 22, 2012, 04:55:42 AM »
It's the other way around in this case - "number" in the example refers to your number (the sender) and destination is the number which you are sending to (the receiving number). Technically these are SMPP addresses, but for sending SMS messages they are basically phone numbers. The sending number (*120*465#) doesn't look right to me - this should be the number of the sender.

1. You do need to check that the TON and NPI are correct:

The Type of Number (TON) indicates the scope of the address value, such as whether it is an international number (i.e. including the country code), a "national" or domestic number (i.e. without country code), and other formats such as "local" format (e.g. in the U.S., without an area code).

The NPI indicates the numbering plan used. The numbering plan chosen will aid the routing system in determining the correct network system to direct the message.

These will be provided by your provider.

2. You are using port 2775, which may well not be correct for your provider, try 1775 for a start, and verify it with your provider

3. Trying using the international form of the phone number, so instead of "083.." you would have "2783.." (drop the zero and add the country code for South Africa).

Web Server - Ask For Help / Re: SMPP
« on: March 22, 2012, 12:23:56 AM »
You are setting system_type before the message is sent, rather than before binding. The system_type relates to the entire session, from when you Bind to when you Unbind.
Set this property before you do anything else, and before to call to DoBind(), which is what establishes the connection with the server (message center).

Setting Smpp.system_type = '$MD before submitting a message will have no effect, as the system_type applies to the packet sent to bind (establish a connection), which has already been sent at this point. Set this property before calling DoBind() will fix this.

The SMPP protocol defines different types of packets for performing different tasks, and NetTalk contains classes which handle each of these packet types. This means that you receive any packet and NetTalk will determine the type and assign the data to a packet object. Each object knows how to encode itself into packet data and how to decode the packet data and set the properties of the object to the correct values. This is what the example is demonstrating - how to create object to handle the different types of packets and different responses. I actually think that the SMPP classes in NetTalk are a fairly nice demonstration of how Object Orientation can provide a very elegant solution to this sort of architecture.

None of the NetTalk objects have any limitations in terms of the amount of data that can be sent and received. The lower level classes are packet based, so larger amounts of data should be split into packets. The example demonstrates splitting and assembling the packets. This is why Process is (and should be) called multiple times when more than one packet is received.

The higher level classes handle this for you, and in fact even the NetSimple class will handle this for you if you have a NetSimpleClient and NetSimpleServer (see the WholePacket example).

The docs are currently missing the Digest Based auth, however the code is in the demo. NetTalk provides a method that creates the authorization for you:

      ThisWebClient.Authorization = ThisWebClient.CreateAuthorizationString (Username, Password, AuthenticationType)
      ThisWebClient.ProxyAuthorization = ThisWebClient.CreateAuthorizationString (ProxyUsername, ProxyPassword, ProxyAuthenticationType)

The AuthenticationType parameters is set to Net:WebBasicAuthentication (0) for Basic or Net:WebDigestAuthentication (1) for Digest based auth. See the TestWebClient procedure in the NetTalk Demo example.

In terms of NTLM it is not supported and is unlikely to ever be. It is an undocumented, proprietary protocol. It is only used by Microsoft and is intended for authentication between Microsoft Products. There are a few open source project attempting to built NTLM compatible libraries, although it is something of a moving target.

E-Mail - Ask For Help / Re: Mail Images included
« on: May 23, 2011, 12:48:39 AM »
You need to embed the images, which is done by adding them to the EmbedList and modifying the HTML image URLS to use the embedded 'cid:' syntax. With NetTalk 5 this entire process can be done simply by calling the EmbedImages() method:

Code: [Select]
EmaiSender.EmbedList = EmailSender.EmbedImages(HtmlData)

E-Mail - Ask For Help / Re: Subject Problem
« on: May 23, 2011, 12:45:46 AM »
This doesn't apply to the Subject line, which doesn't support character sets outside of ASCII. There is a workaround in later versions of the SMTP specification for this that provides multiple encodings within the Subject, however it is not currently supported by NetTalk.

E-Mail - Ask For Help / Re: Bad spanish email
« on: May 23, 2011, 12:43:34 AM »
The default encoding for mail is us-ascii, which doesn't support these characters. Change the encoding to  'iso-8859-1':

EmailSender.OptionsMimeTextCharset = 'iso-8859-1'
EmailSender.OptionsMimeHTMLCharset = 'iso-8859-1'

Web Server - Ask For Help / Re: nettalk and ubuntu server
« on: May 23, 2011, 12:40:02 AM »
I'm simply run it on a Virtual Machine running a Windows guest OS. I have found that it typically a better long term solution than WINE.

FTP - Ask For Help / Re: Secure FTP uploads
« on: June 02, 2010, 12:13:06 AM »
There is however a simple (free) workaround - use SafeTP to secure the FTP connection -

Web Server - Ask For Help / Re: SHA-1 hash and Base64/Base32
« on: June 01, 2009, 10:18:30 PM »
Hi Kevin,

I've done this via a third party library, but it isn't functionality that is included in NetTalk. Are you trying to create a digital signature by any chance?

Capesoft SafeUpdate creates (and reads) standard signatures using Canonical XML, SHA-1 hashing and Base64 encoding. If that is what you are looking for then CapeSoft SafeUpdate contains all the code that you need already.



Hi Brian,

At the moment this is is not built in, although I have a digest auth class that will be added to NetTalk to provide digest based authentication for the NetWebClient (HTTP) class (and all other classes for that matter).


Sean Cameron

The Rest - Ask For Help / Re: NetSimple Server
« on: July 01, 2008, 11:16:11 PM »
It sounds like you are receiving binary data and trying to display it in a text control (or something similar). What data are you expecting to get from the GPS tracker? You will need to handle processing and parsing the data yourself (for example if could be binary data, it could be Unicode text and so on).

NetTalk is asynchronous, so we don't advise treating it in a synchronous fashion. In the case of email sending, each time the Send() method is called NetTalk buffers the mail, which lets you get away with treating the email send method as if it was synchronous, and doing things such as calling Send() in a tight loop. That said, it is definately not the best approach. NetTalk provides callback methods that allow you to respond to email being sent, errors occurring and so on. This is far more robust and allows you to ensure that mail is send, handle errors correctly and so on.
1) Create a Setup routine that sets everything up, fills in the email server details etc. and does the Set() on the file (this assumes that you are looping through a file and fetching the records to send, but the same approach works regardless of the source of the email):
  ! "Set up" NetTalk
  ThisEmailSend.Server  = EmailServer
  ThisEmailSend.Port    = EmailPort
  Do ProcessEmail
2) Create a ProcessEmail routine that sends each message:
ProcessEmail routine
  if Access:EmailFile.Next()                ! End of records in the EmailFile table
    Message('All Messages have been sent')
  else                                              ! Found a record to send
       ThisEmailSend.ToList  = Clip(efn:f1)
       ThisEmailSend.SetRequiredMessageSize (0, len(clip(EmailMessageText)), len(clip(EmailMessageHtml)))
       if ThisEmailSend.Error = 0
            ! This should NEVER happen, it means memory allocation failed
            ! This is likely to be a fatal error, so you might want to abort the connection
            ! Memory allocation should not fail in the normal course of things
            Message ('An error occurred while trying to send the mail. Could not allocate memory', 'Error', ICON:Exclamation)

3) Now the first message has been sent you wait for one of two NetEmailSend methods to fire:
ErrorTrap() - called if the sending failed or an error occurs
MessageSent() - called when the message is sent successfully
a) Add code in ErrorTrap to handle errors, before the parent call:
EmailSender.ErrorTrap PROCEDURE(...
    ! You can handle all error in the same fashion if you prefer, but I try to
    ! handle message specific errors seperately from errors that will cancel the entire send
    if self._ErrorStatus = NET:ERROR_STATUS_SERVER_ERROR
        ! A server error occured, like the connection was terminate etc. No more mail will be
        ! sent at this point, although messages that have already been sent are fine
        Message('Sorry but sending the batch of mail failed, a server error occured: ' & Clip(errorStr))
        ! Just this message failed, so we can carry on sending
        Message('Sorry but the current email could not be sent: ' & Clip(errorStr))
        Do ProcessEmail               ! Send the next one
b) Add code in MessageSent() when a message gets sent
EmailSender.MessageSent PROCEDURE
    ! You can delete the entry that was sent here from the Email table or mark it as sent etc.
    Do ProcessEmail                    ! Send the next one.
4) Finally in the Event:Timer embed (add a timer to the window) call:
This will set the EmailSender.Progress1000 properties to the current progress in increments of 1/1000th. The easiest way to have a progress control is in the ThisWindow.Init() method after the Open(window) call set the EmailSender.ProgressControl property to the handle of a progress control on your window.
   EmailSender.ProgressControl = ?OurProgress

On first glance it probably looks more complex than it actually is, but it is the best approach to take when working with NetTalk, and also has the advantage that you are never in a tight loop, so your application remains responsive to the user. Basically the code is identical except instead of calling the methods in a loop you wait for NetTalk to inform you that a message has been sent or that an error has occurred. You can display a progress bar easily, track which messages are sent, handle errors well etc.

E-Mail - Ask For Help / Re: How do I FWD a copy of email received?
« on: July 01, 2008, 10:54:44 PM »
Forwarding an email with NetTalk is actually very simple.

You need two objects:

NetEmailReceive - to retrieve the email
NetEmailSend - to send the email on (forward it).

Each time an email is received and processed you set the properties of the NetEmailSend object using the properties of the NetEmailReceive Object. You can also prepend "FW: " to the subject and modify the body to indicate a forwarded mail if desired. Once you have assigned the data you send the mail normally calling the .Send() method.

The other alternative is to store all incoming mail in a table, and have a separate thread that processes the table periodically and forwards any mail that has not yet been sent. Both approaches work well.

FTP - Ask For Help / Re: .ChangeDir()
« on: September 20, 2007, 11:24:11 PM »
Hi Wolfgang,

It checks for both, first for a forward slash and then for a backslash if there is no forward slash. Note that it will break if you mix forward slashes and backslashes in a single directory specification, but that should never happen.


Sean Cameron
Work Smarter, Not Harder

Pages: [1] 2