Page 22 of 25
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Fri Dec 31, 2010 11:34 am
by loulou
Can you developed a version in which html mail will be possible ?
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Fri Dec 31, 2010 11:43 am
by gnozal
loulou wrote:Can you developed a version in which html mail will be possible ?
I do not know any SMTP command to handle the outbox.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Fri Dec 31, 2010 12:09 pm
by DoubleDutch
It may be handy to have a function to send RAW commands to the SMTP server and get the RAW reply (on the current PureSMTP connection)? Possible the same for the PurePop3 library too?
(I wish Fred would add this to his FTP and Mail libraries)
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Fri Dec 31, 2010 12:23 pm
by gnozal
DoubleDutch wrote:It may be handy to have a function to send RAW commands to the SMTP server and get the RAW reply (on the current PureSMTP connection)? Possible the same for the PurePop3 library too?
Sending some user defined text is not a problem.
But how to handle the server answer ? It maybe a short text, megabytes of data, or an error message.
This is handled by a message loop in PureSMTP.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Fri Dec 31, 2010 12:40 pm
by DoubleDutch
I see what you mean, maybe specify a timeout in the send command - all data captured in an expanding memory buffer until that time has passed since last data reply? It could default to 1/2 second? The memory address would be the return parameter?
eg:
Code: Select all
reply=PureSMTP_RawSend(command$[,timeout])
if reply
.
.
.
FreeMemory(reply)
endif
This way other users can add commands that may be missing (they may only be on certain servers and not part of the official SMTP spec?) and submit them to you for 'offical' inclusion (if you like)?
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Fri Dec 31, 2010 12:57 pm
by gnozal
I will try to think of something usable.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Thu Jan 27, 2011 1:32 pm
by C64
Is PureSMTP_SetContentType() meant to remember its setting after PureSMTP_CloseSMTPConnection() is called? Because once I set the content type to "text/html" and send an email, and close the connection, the next email sent is also "text/html" instead of the default of "text/plain". I would've thought the default would be used whenever PureSMTP_OpenSMTPConnection() is called?
Basically, I currently have to do this with my program:
Code: Select all
;monospaced is a global variable depending on how I want to send.
If PureSMTP_OpenSMTPConnection(...)=#PureSMTP_Ok
If monospaced=1
PureSMTP_SetContentType("text/plain; charset=iso-8859-1")
Else
PureSMTP_SetContentType("text/html; charset=iso-8859-1")
EndIf
result=PureSMTP_SendMail(...)
PureSMTP_CloseSMTPConnection()
EndIf
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Thu Jan 27, 2011 2:24 pm
by gnozal
C64 wrote:Is PureSMTP_SetContentType() meant to remember its setting after PureSMTP_CloseSMTPConnection() is called?
Yes, like PureSMTP_SetXMailer() and PureSMTP_SetBoundary().
Set the value to "" to reset to default value.
I have updated the help file.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 01, 2011 1:58 pm
by C64
Thank you. Another question (for you or any lurkers): I can easily send image attachments with PureSMTP, but what about sending an HTML email with the image embedded? I know I'd have to compose the email body with HTML tags, but I'm unsure of how I'd get the image data in there. Base64 I assume, with boundaries? Am I close? Can someone post some theory so I can do the practice? Thanks again.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 2:19 pm
by C64
Found a bug (I think) in PureSMTP today, when trying to use PureSMTP_AddHeader(). Reproducible code follows (without my data). Example taken from the PureSMTP help file. Using PureBasic 4.51 and the latest PureSMTP library, on XP (32-bit). Turning the Purifier on gives a different address in the error message, rather than 0. Changing the addresses in MailTo and MailFrom doesn't fix the error.
Code: Select all
Line: 12 - Invalid memory access. (write error at address 0)
Code: Select all
MySMTPServer.s = "MySMTPServer"
MySMTPPort.l = 25
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
Debug PureSMTP_GetLastServerMessage()
MailTo.s = "whoever@you.want"
MailFrom.s = "root@127.0.0.1"
Subject.s = "Test"
MsgBody.s = "Testing PureSMTP"
Attachments.s = ""
;Username.s = "TEST"
;Password.s = "TEST"
PureSMTP_AddHeader("X-MSMail-Priority", "High")
; sending mail
Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody)
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
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 4:05 pm
by gnozal
C64 wrote:Found a bug (I think) in PureSMTP today, when trying to use PureSMTP_AddHeader(). Reproducible code follows (without my data). Example taken from the PureSMTP help file. Using PureBasic 4.51 and the latest PureSMTP library, on XP (32-bit). Turning the Purifier on gives a different address in the error message, rather than 0. Changing the addresses in MailTo and MailFrom doesn't fix the error.
Sorry, I can't reproduce the issue : the mail is sent with high priority as expected.
No debugger error.
No purifier alert.
No crash.
PB4.51 / XP sp3 x86
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 4:14 pm
by C64
I noticed I also get the exact same crash with just one line in the IDE like this (compile/run it):
Code: Select all
PureSMTP_AddHeader("X-MSMail-Priority", "High")
What does this do on your PC?
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 4:16 pm
by gnozal
C64 wrote:I noticed I also get the exact same crash with just one line in the IDE like this (compile/run it):
Code: Select all
PureSMTP_AddHeader("X-MSMail-Priority", "High")
What does this do on your PC?
Nothing.
Note : this function just adds an element to a linked list in the library.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 4:52 pm
by C64
With the Purifier enabled, the single line compiles and runs fine. Disabled, it crashes. Just musing out loud.
[Update] Just noticed that if I enable "Create Threadsafe Executable", the single lines causes this:
Code: Select all
---------------------------
PureBasic - Linker error
---------------------------
POLINK: error: Unresolved external symbol '_PB_StringBasePosition'.
POLINK: fatal error: 1 unresolved external(s).
---------------------------
OK
---------------------------
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 5:18 pm
by DoubleDutch
You should do a reinstall of purebasic and the extra libs - it works fine on mine.