PureSMTP library : mail & attachments (AUTH supported)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

supercdfr
User
User
Posts: 54
Joined: Tue Mar 16, 2010 9:28 pm

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by supercdfr »

I can't use any of the gnozal because of the MISC missing.
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 :cry:
Falko
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by Falko »

+1 :D


[Edit]
No answer is also any answer :(
But I'm hoping that will come a new version for PB 5.20+
[/Edit]
Last edited by Falko on Tue Jan 21, 2014 11:02 pm, edited 1 time in total.
www.falko-pure.de
Win8 Pro 64-Bit & Mediacenter, PB_5.1B7, GFA-WinDOS, Powerbasic9.05-Windows, NSBasic/CE, NSBasic/Desktop, NSBasic4APP, EmergenceBasic
Rbender
User
User
Posts: 14
Joined: Thu Sep 19, 2013 8:23 am

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by Rbender »

It does not seem to be true :(
Anyone know why?
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by IdeasVacuum »

PureSMTP is excellent, I have used it a lot. However, ts-soft has published an equally good solution which has been enhanced by a number of people: http://www.purebasic.fr/english/viewtop ... 12&t=50538
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Rbender
User
User
Posts: 14
Joined: Thu Sep 19, 2013 8:23 am

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by Rbender »

Thx for the tipp. First tests look great. :D
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by ruslanx »

Hi, can someone help me to fix the code ..
... how can I send mail in HTML with Attachment .. better look at screenshots to understand my problem.

ImageImage

.. with attachment .. I have problems ??!!!

The Code:

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

.... the body text is in cyrillic (1251).

Thankyou.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by IdeasVacuum »

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
If it sounds simple, you have not grasped the complexity.
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by ruslanx »

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?

can suggest me some a good mail library ... ... ?
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by IdeasVacuum »

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

Re: PureSMTP library : mail & attachments (AUTH supported)

Post by ruslanx »

IdeasVacuum wrote:Have a look at ts-soft's: http://www.purebasic.fr/english/viewtop ... 12&t=50538

thank you .. i'll try.

UPD: thank you .. work now perfect :).
Post Reply