I am a teacher, so we have a computer that is connected directly to the internet through the greek school network. AVG 8.5 internet security is installed and even if I disable the firewall component, PureSMTP_OpenSMTPConnection() fails. I am thinking this: there is a server of the greek school network, that lies somewhere in Athens, and I think that this server may block the connections to servers other than itself. I do not know if this is possible. This server is definitely intercalated between me and the web because some sites are not accessable and a message saying that the page cannot be viewed because of the content, so I think that it may be responsible for my problem.gnozal wrote:I guess PureSMTP_OpenSMTPConnection() fails because you have a corporate firewall / proxy at work, and unfortunately Purebasic network functions don't support proxies.
I have the same issue at work.
PureSMTP library : mail & attachments (AUTH supported)
Moderator: gnozal
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
I was right! I tried to send through the school server and the mail sent. Can I do something to be able to send via gmx or any other server that I have account? I need a way to bypass the stupid mail.att.sch.gr server.gnozal wrote:I guess PureSMTP_OpenSMTPConnection() fails because you have a corporate firewall / proxy at work, and unfortunately Purebasic network functions don't support proxies.
I have the same issue at work.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Did you try to use PureSMTP_OpenSMTPConnection() with the gmx server ?doctorized wrote:I was right! I tried to send through the school server and the mail sent. Can I do something to be able to send via gmx or any other server that I have account? I need a way to bypass the stupid mail.att.sch.gr server.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Yes, the first server that I used was gmx (mail.gmx.com). I found a list with about 350 servers (http://www.e-eeasy.com/SMTPServerList.aspx), the code connected with none of them. Only the school server connects correctly.gnozal wrote:Did you try to use PureSMTP_OpenSMTPConnection() with the gmx server ?
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
I am sorry, but I don't know how to 'bypass' a firewall in Purebasic.doctorized wrote:Yes, the first server that I used was gmx (mail.gmx.com). I found a list with about 350 servers (http://www.e-eeasy.com/SMTPServerList.aspx), the code connected with none of them. Only the school server connects correctly.gnozal wrote:Did you try to use PureSMTP_OpenSMTPConnection() with the gmx server ?
Maybe HTTP tunneling (like Yourfreedom) would work, but it's a bit overkill ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (PB4.3x version only)
Changes :
- enhanced function PureSMTP_SendMail() : added memory attachments.
You may specify a memory bank instead of a filename.
. syntax : use "mem:{Filename}:{*InputBuffer}:{InputBufferLength}" instead of "{Path+Filename}"
. example :
Changes :
- enhanced function PureSMTP_SendMail() : added memory attachments.
You may specify a memory bank instead of a filename.
. syntax : use "mem:{Filename}:{*InputBuffer}:{InputBufferLength}" instead of "{Path+Filename}"
. example :
Code: Select all
...
If ReadFile(666, "c:\PureBasic430\Program\test.zip")
InMemAttachmentLen = Lof(666)
*InMemAttachment = AllocateMemory(InMemAttachmentLen)
If *InMemAttachment
ReadData(666, *InMemAttachment, InMemAttachmentLen)
Attachments.s = "mem:test.zip:" + Str(*InMemAttachment) +":" + Str(InMemAttachmentLen)
EndIf
CloseFile(666)
EndIf
...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re:
I have 64bit XP PRO, Windows 7 x64 and PB x64 4.30. I can help you make x64 lib.gnozal wrote:only x86 libs, as I don't have a 64bits OS.
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Char(10) lost after file transfer with PureSMTP
I use Gnozal's PureSMTP to send mails with attachments.
I have some codes like this one:When I downloaded the file, I noticed that the enter key, chr(10) + chr(13), is not normally present. Chr(10) is missing after the date, only chr(13) is present.
The original file on my hard disk has chr(10) but the downloaded one doesn't. If I try to sent bigger files then chr(10) is present. Can somebody explain me why, please?
I have some codes like this one:
Code: Select all
CreateFile(0,"c:\text.txt")
WriteStringN(0, FormatDate("%dd/%mm/%yyyy - %hh:%ii:%ss",Date()))
WriteString(0,"Text saved")
CloseFile(0)
If PureSMTP_OpenSMTPConnection("your smtp server", 25) = #PureSMTP_Ok
MailTo.s = "the taker address"
MailFrom.s = "your email address"
UserName.s = "your id"
Password.s = "your password"
Subject.s ="Hi!"
MsgBody.s = "file attached"
Attachments.s = "c:\text.txt"
Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, Attachments, UserName, Password)
PureSMTP_CloseSMTPConnection()
If Status = #PureSMTP_Ok
Debug "file sent"
Else
Debug "failed"
EndIf
Else
Debug "connection failed"
EndIf
The original file on my hard disk has chr(10) but the downloaded one doesn't. If I try to sent bigger files then chr(10) is present. Can somebody explain me why, please?
Re: Char(10) lost after file transfer with PureSMTP
It's probably your mail client saving the file, that's causing the problem. When I run your code, the saved file is exactly the same as what the code originally created, except for a new added CRLF at the end of it. So, my client (Outlook) adds a single new CRLF when saving the attachment. Other than that, the file attachment is 100% the same, byte-for-byte (confirmed with a hex editor), as it was created. Don't forget that Outlook strips line breaks in emails, so that may be doing something to the attachment too.
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re: Char(10) lost after file transfer with PureSMTP
I am not using any client. I send the mail with PB and then I download the attachment from the provider's web page with Firefox.Mr Coder wrote:Don't forget that Outlook strips line breaks in emails, so that may be doing something to the attachment too.
Re: Char(10) lost after file transfer with PureSMTP
Try the same code with PureBasic's mail sending, and see if it works. That way we'll know if PureSMTP has a bug or not. I doubt it does, though. Sounds like the mail server or downloading action is modifying the text file on the fly. Try also mailing a binary file (an executable?) with PureSMTP, and if that comes through okay then PureSMTP is definitely not the problem.
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re: Char(10) lost after file transfer with PureSMTP
I sent a dll file and the downloaded file has the same CRC32 code with the original one, so PureSMTPMr Coder wrote:Try also mailing a binary file (an executable?) with PureSMTP
works fine. I did one more test and found out this: if the taker is gmx.com or yahoo.com then chr(10)
is lost after downloading, but when the taker is hotmail.com then the file comes back ok. I did it with both
IE and firefox so the downloading action is not responsible for this. Why do yahoo and gmx f*ck attachments?
Re: PureSMTP library : mail & attachments (AUTH supported)
POLINK error _PB_StringBasePosition using PB4.50 with threadsafe switched on
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureSMTP library : mail & attachments (AUTH supported)
Did you enable the 'UserLibThreadSafe' subsystem ?AndyMK wrote:POLINK error _PB_StringBasePosition using PB4.50 with threadsafe switched on
PureSMTP.chm (How to use this library in unicode and/or thread-safe mode) wrote:This library exists in several versions :
- the standard version, located in %Purebasic%\PureLibraries\UserLibraries\ ;
- the thread-safe version, located in %Purebasic%\SubSystems\UserLibThreadSafe\PureLibraries\ .
- the unicode version, located in %Purebasic%\SubSystems\UserLibUnicode\PureLibraries\ .
- the unicode + thread-safe version, located in %Purebasic%\SubSystems\UserLibunicodeThreadSafe\PureLibraries\ .
In order to use this library in thread-safe mode (compiler option /THREAD), you have to enable the subsystem 'UserLibThreadSafe'
in the PB IDE, or add '/SUBSYSTEM UserLibThreadSafe' to the PBCompiler arguments. In jaPBe, do nothing : it will automatically
enable the 'UserLibThreadSafe' subsystem to use the threadsafe versions of the installed userlibraries.
It's the same logic for unicode and unicode + thread-safe modes.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Re: PureSMTP library : mail & attachments (AUTH supported)
Thanks, didn't see that one.