maybe this way :Frontier wrote:I've tried PureSMTP_SetContentType("multipart/mixed; charset=iso-8859-7")
PureSMTP_SetContentType("text/plain; charset=iso-8859-7")
Moderator: gnozal
maybe this way :Frontier wrote:I've tried PureSMTP_SetContentType("multipart/mixed; charset=iso-8859-7")
It workedFlype wrote:maybe this way :Frontier wrote:I've tried PureSMTP_SetContentType("multipart/mixed; charset=iso-8859-7")
PureSMTP_SetContentType("text/plain; charset=iso-8859-7")
Code: Select all
PureSMTP_SetXMailer("LockOff")
Code: Select all
Global ..., PureSMTP_XMailer.s, ...
ProcedureDLL PureSMTP_Init()
...
PureSMTP_XMailer = "PureSMTP"
...
EndProcedure
ProcedureDLL PureSMTP_SetXMailer(XMailer.s) ; Set X-Mailer [Default is "PureSMTP"]
PureSMTP_XMailer = XMailer
EndProcedure
Code: Select all
If InitNetwork() = 0
MessageRequester("Error", "Can't initialize the network !", 0)
End
EndIf
Port = 6832
Buffer = AllocateMemory(1000)
If CreateNetworkServer(0, Port)
MessageRequester("PureBasic - Server", "Server created (Port "+Str(Port)+").", 0)
; ******
MySMTPServer.s = "MySMTPServer"
MySMTPPort.l = 25
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
Debug PureSMTP_GetLastServerMessage()
MailTo.s = "MyName@MyServer"
MailFrom.s = "PureSMTP@testing"
Subject.s = "Test (with login authentication)"
MsgBody.s = "Testing PureSMTP"
Attachments.s = ""
UserName.s = "TEST"
Password.s = "TEST"
; sending mail
Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, Attachments, UserName, Password)
If Status = #PureSMTP_Ok
Debug "Message : sent"
Debug "Status = " + Str(Status)
Else
Debug "Message : something went wrong !"
Debug "Status = " + Str(Status)
Debug PureSMTP_GetLastServerMessage()
EndIf
PureSMTP_CloseSMTPConnection()
Else
Debug "OpenSMTPConnection failed"
Debug PureSMTP_GetLastServerMessage()
EndIf
; ******
ConnectionID = OpenNetworkConnection("127.0.0.1", Port)
If ConnectionID
MessageRequester("PureBasic - Client", "Client connected to server...", 0)
SendNetworkString(ConnectionID, "An hello from a client !!! :-)")
MessageRequester("PureBasic - Client", "A string has been sent to the server, please check it before quit...", 0)
CloseNetworkConnection(ConnectionID)
Else
MessageRequester("PureBasic - Client", "Can't find the server (Is it launched ?).", 0)
EndIf
Repeat
SEvent = NetworkServerEvent()
If SEvent
ClientID = EventClient()
Select SEvent
Case 1
MessageRequester("PureBasic - Server", "A new client has connected !", 0)
Case 2
MessageRequester("PureBasic - Server", "Client "+Str(ClientID)+" has send a packet !", 0)
ReceiveNetworkData(ClientID, Buffer, 1000)
MessageRequester("Info", "String: "+PeekS(Buffer), 0)
Case 4
MessageRequester("PureBasic - Server", "Client "+Str(ClientID)+" has closed the connexion...", 0)
Quit = 1
EndSelect
EndIf
Until Quit = 1
MessageRequester("PureBasic - Server", "Click to quit the server.", 0)
CloseNetworkServer(0)
Else
MessageRequester("Error", "Can't create the server (port in use ?).", 0)
EndIf
End
You are right.DoubleDutch wrote:There seems to be a problem with PureSMTP and running a network server...
With this code, the client can connect to the server - but no data can be transfered. Comment out the PureSMTP code and it works fine.
Code: Select all
PureSMTP_SkipInitNetwork(#True) ; defaults to false on library init
Code: Select all
PurePOP3_SkipInitNetwork(#True) ; defaults to false on library init
What do you think of this : I could also move InitNetwork() to PureSMTP_Init(), so it is only called once and in your code just don't call InitNetwork() when you use the library. So it works.DoubleDutch wrote:I think that this is something that Fred should sort out.