1 of the most useful lib put away by purebasic, that's the first time i see that.
Gnozal, if you read this, please help us

Moderator: gnozal
Code: Select all
; Header -----------------------------------------------------
MsgBody.s = ""
MsgBody + "<div style='background-color:#F0F8FF;font-family:verdana;padding:6px;border-radius:3px;border:2px solid #72B68F;'>"
MsgBody + "<h3 style='text-align:center;color:Green;'><ins> TEST </ins></h3>"
; """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
; Window Header -----------------------------------------------
MsgBody + "<div style='opacity:0.9;background-color: #72B68F; border-radius:3px;border:1px solid #505050; padding: 5px;'>"
MsgBody + "<font size='2' color='#000000'><i><b> NAME1: </b></i></font>"
MsgBody + "<font size='2' color='#FFFFFF'><i><b> TEXT1 </b></i></font><br/>"
MsgBody + "<font size='2' color='#000000'><i><b> NAME2: </b></i></font>"
MsgBody + "<font size='2' color='#FFFFFF'><i><b> TEXT2 </b></i></font><br/>"
MsgBody + "<font size='2' color='#000000'><i><b> NAME3: </b></i></font>"
MsgBody + "<font size='2' color='#FFFFFF'><i><b> TEXT3 </b></i></font><br/></div>"
; """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
; Text ...
MsgBody + "<font size='2' color='#000000'><i><b>" + "owiefwehuiuyuiyiuuiyiuHGUIUHIUIHUIHГШНРПГШЕКВАНЩОШОШЩОшщущгксвыьдацзщ89е7у90-ш4сждычсагшЭ." + "</b></i></font>"
MsgBody + "<br/>"
MySMTPServer.s = "mail.rambler.ru"
MySMTPPort.l = 587
MailTo.s = "pure-test@rambler.ru"
MailFrom.s = "pure-test@rambler.ru"
Subject.s = "Test (with attachments)"
Username.s = MailFrom
Password.s = "test1234"
Attachment$ = ""; "d:\1.jpg"
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
PureSMTP_SetXMailer("Testemail")
;PureSMTP_SetContentType("multipart/alternative; charset=UTF-8")
PureSMTP_SetContentType("text/html; charset=windows-1251")
PureSMTP_AddHeader("X-MSMail-Priority", "Normal")
Head$ = "<head><meta http-equiv="+Chr(34)+"Content-Type"+Chr(34)+" content="+Chr(34)+"text/html; charset=windows-1251"+Chr(34)+"></head><body>"
Footer$ = "</div></body></html>"
Message$ + Head$ + MsgBody + Footer$
Status = PureSMTP_SendMail(MailTo, MailFrom, Subject, Message$, Attachment$, Username, Password, "Content-Type: text/html; charset=windows-1251")
If Status = #PureSMTP_Ok
Title$ = "Success"
Msg$ = PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
Else
Title$ = "Error"
Msg$ = "Sendmail error code: " +Str(Status) + Chr(10) + PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
EndIf
Else
Title$ = "Error"
Msg$ = "OpenSMTP error: " + Chr(10) + PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
EndIf
IdeasVacuum wrote:Well, I would say ensure that your output is Unicode, but you must have had a problem with that as you have commented-out that content type. I assume you mean that without an attachment, the code works fine? I just tried to test it in PB4.61 and get an error, but that might have something to do with Avast AV not liking PB4.61.
I don't think you can go far with PureSMTP, it's not supported for PB5.22 and gnozal has been away from the forum for some time now...... have you tried an alternative?
IdeasVacuum wrote:Have a look at ts-soft's: http://www.purebasic.fr/english/viewtop ... 12&t=50538