BBC BASIC for Windows
Programming >> Communication and Input/Output >> SMTP http://bb4w.conforums.com/index.cgi?board=communication&action=display&num=1350649804 SMTP
Post by Nanne on Oct 19th, 2012, 12:30pm
Hi there,
I am using the socklib library. I made a program to get the statistics from an IRC chatlog.
Nothing in SOCKLIB removes spaces! You can look at the code yourself to confirm that. If you are using FN_writelinesocket() the entire string is passed to FN_writesocket() and thence to send. If you write a simple loop-back test, passing strings via sockets, multiple spaces are preserved.
Are you sure the problem isn't in the email client that you are using to view the received message? Some viewers automatically reduce multiple spaces to one space (for example Yahoo Groups does that, unless you select the 'fixed pitch font' option).
Richard.
Re: SMTP
Post by Nanne on Oct 19th, 2012, 4:28pm
Hi Richard,
You are completly right. The library itself doesn't remove spaces. It is the email client. In this case gmail.com and hotmail.com. Gmail.com says that the mail is may be spam and hotmail.com accepted it. The only problem is that the remove spaces. I asked my question here because I cannot find a solution on the net. So maybe other users have the same problem and perhaps they have a solution.
Nanne
Re: SMTP
Post by admin on Oct 19th, 2012, 9:29pm
So maybe other users have the same problem and perhaps they have a solution.
You could try using non-break spaces (ANSI code 160 decimal / &A0 hexadecimal / HTML ); it's possible that the email clients won't remove those. The only thing to watch is that strictly you may need to include a MIME header in the email to specify that you're using a non-ASCII character encoding.
Richard.
Re: SMTP
Post by Nanne on Oct 19th, 2012, 11:19pm
Hi Richard,
It works with CHR$160.
Thank you for this solution!
Nanne
Re: SMTP
Post by Nanne on Oct 23rd, 2012, 10:44pm
Is it possible to send a file using the socklib library. And If so how I have to do that?
I tried:
IF FN_writelinesocket(skt%, "Attach: "+"test.txt")
But it didn't work.
Nanne
Re: SMTP
Post by admin on Oct 24th, 2012, 08:20am
Is it possible to send a file using the socklib library.
I assume from the context that you are referring to attaching a file to an email (rather than uploading it to an FTP server, for example). Is that right?
Is it possible to attach af file with using the socklib library?
Certainly it is "possible", but I'm not aware of anybody having done it before. You would need to create a multipart MIME email including the attachment, suitably encoded (e.g. as 'base64'). There is some useful information on what is needed here:
At a quick glance it looks quite easy. Let us know how you get on (and ideally write a Wiki article - or even a BB4W library - for the benefit of others).
Richard.
Re: SMTP
Post by admin on Oct 24th, 2012, 5:30pm