Page 23 of 25
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 5:22 pm
by gnozal
C64 wrote:Just noticed that if I enable "Create Threadsafe Executable", the single lines causes this:
POLINK: error: Unresolved external symbol '_PB_StringBasePosition'.
Please have a look at the 'Unicode_Thread-safe' topic in PureSMTP.chm : you need to enable a subsystem.
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Tue Feb 08, 2011 9:55 pm
by C64
I did a clean PureBasic install (even deleting the old Prefs files in AppData) and then installed PureSMTP on top, then entered the single line above, and ran it. Below is the result. I don't know what else I can do. Maybe someone else with XP can try these steps and confirm if it happens for them too. If at least one other person confirms it, then I shall be happy, because I'll know it's not just me.

Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Wed Feb 09, 2011 9:14 am
by gnozal
C64 wrote:I did a clean PureBasic install (even deleting the old Prefs files in AppData) and then installed PureSMTP on top, then entered the single line above, and ran it. Below is the result. I don't know what else I can do.
Here is the code : there is not much that may go wrong.
Code: Select all
ProcedureDLL PureSMTP_AddHeader(Header.s, String.s)
If Header And String
AddElement(PureSMTP_Header())
If LCase(Header) = "reply-to"
String = GetRealMailFrom(String)
EndIf
PureSMTP_Header()\Header = Header
PureSMTP_Header()\String = String
EndIf
EndProcedure
The only thing I see is that the linked list may not be initialized. This is done in PB_PureSMTP_Init()
Here is the ASM output :
pbcompiler AddHeaderAlone.pb /commented wrote:...
PureBasicStart:
...
CALL _SYS_InitString@0
CALL _PB_InitMemory@0
CALL _PB_InitList@0
CALL _PB_InitFile@0
CALL PB_PureSMTP_Init
;
; PureSMTP_AddHeader("X-MSMail-Priority", "High")
PUSH dword _S1
PUSH dword _S2
CALL PB_PureSMTP_AddHeader
...
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Wed Feb 09, 2011 12:19 pm
by C64
I hope the singlet is enough compensation.

Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Sat Mar 12, 2011 7:20 pm
by SunSatION
Hi gnozal,
I'm having some trouble using the bcc parameters. I've set the MailTo parameter to:
Code: Select all
MailTo.s = "****@go.net.mt;bcc:*****1@gmail.com;bcc:*****2@gmail.com"
and this is the data sent to the server ( wireshark )
Code: Select all
220 fender72.go.net.mt ESMTP Exim 4.67 Sat, 12 Mar 2011 18:58:09 +0100
Ehlo PureSMTP
250-fender72.go.net.mt Hello PureSMTP [80.71.106.113]
250-SIZE 15728640
250-PIPELINING
250 HELP
AUTH LOGIN
503 AUTH command used when not advertised
MAIL FROM: <*****@go.net.mt>
250 OK
RCPT TO: <*****@go.net.mt>
250 Accepted
RCPT TO: <*****1@gmail.com>
250 Accepted
RCPT TO: <*****2@gmail.com>
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
From: <*****@go.net.mt>
To: <*****@go.net.mt>
Bcc: <*****1@gmail.com>
Bcc: <*****2@gmail.com>
Subject: Test (with login authentication)
X-Mailer: PureSMTP
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Testing PureSMTP _ ONLY BCC
.
250 OK id=1PyT4r-0006Il-UT
QUIT
221 fender72.go.net.mt closing connection
All the addresses were visible in the header in Gmail under Bcc. So I went to try it with Outlook to check if it is a server problem but it worked by omitting the bcc from the header.
wireshark
Code: Select all
220 fender70.go.net.mt ESMTP Exim 4.67 Sat, 12 Mar 2011 19:15:26 +0100
EHLO sunlaptop
250-fender70.go.net.mt Hello sunlaptop [80.71.106.113]
250-SIZE 15728640
250-PIPELINING
250 HELP
MAIL FROM: <*****@go.net.mt>
250 OK
RCPT TO: <*****@go.net.mt>
250 Accepted
RCPT TO: <*****2@gmail.com>
250 Accepted
RCPT TO: <*****1@gmail.com>
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Message-ID: <001801cbe0e1$774e1360$6402a8c0@sunlaptop>
[b]From: "P2PoE" <*****@go.net.mt>
To: <*****@go.net.mt>
Subject: Test outlook
Date: Sat, 12 Mar 2011 19:15:17 +0100
[/b]MIME-Version: 1.0
Content-Type: multipart/alternative;
.boundary="----=_NextPart_000_0015_01CBE0E9.D2D29910"
X-Priority: 3
X-MSMail-Priority: Normal
....... useless code ..........
.
250 OK id=1PyTLa-0007hT-DZ
QUIT
221 fender70.go.net.mt closing connection
Is there a way to remove the bcc from the header?
Thanks!
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Mon Mar 14, 2011 9:54 am
by gnozal
Update (PB4.5x only)
Changes :
- BCC addresses are removed from the header
PureSMTP library : mail & attachments
Posted: Mon Mar 14, 2011 10:00 am
by loulou
I want to have a background image on an HTML Mail . How can i do ?
Re: PureSMTP library : mail & attachments
Posted: Mon Mar 14, 2011 10:31 am
by gnozal
loulou wrote:I want to have a background image on an HTML Mail . How can i do ?
You probably have to send the message as HTML, but I can't help you further, sorry.
Re: PureSMTP library : mail & attachments
Posted: Mon Mar 14, 2011 10:51 am
by loulou
gnozal wrote:loulou wrote:I want to have a background image on an HTML Mail . How can i do ?
You probably have to send the message as HTML, but I can't help you further, sorry.
My problem is how to param Mail Header to have an image attach to the mail
Re: PureSMTP library : mail & attachments
Posted: Mon Mar 14, 2011 11:56 am
by gnozal
loulou wrote:My problem is how to param Mail Header to have an image attach to the mail
Sorry, I don't know.
Include the image as attachment ?
Re: PureSMTP library : mail & attachments
Posted: Mon Mar 14, 2011 12:46 pm
by loulou
gnozal wrote:loulou wrote:My problem is how to param Mail Header to have an image attach to the mail
Sorry, I don't know.
Include the image as attachment ?
I want only to have a mail like that
Code: Select all
ontent-Type: multipart/alternative;
boundary="------------040006060302020507070601"
This is a multi-part message in MIME format.
--------------040006060302020507070601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi this a message
--------------040006060302020507070601
Content-Type: multipart/related;
boundary="------------040308020001050609000802"
--------------040308020001050609000802
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<div align='left'>
<p>Hi this is a message</p>
<a href='http://www.google.com'>
<img src='cid:image1.gif' alt='image1' style='border-style: none;' height='56' width='200'>
<img src='cid:image2.gif' alt='image2' style='border-style: none;' height='56' width='200'>
<br>
</a>
</div>
<u>Hola! á</u>
</body>
</html>
--------------040308020001050609000802
Content-Type: image/gif;
name="image1.gif"
Content-Transfer-Encoding: base64
Content-ID: <image1.gif>
Content-Disposition: inline;
filename="image1.gif"
R0lGODlhyAA4APcAAFoCBCSCbInCtARFK6iEdCdqXMHj3IyuoAQ9KYRCNNjCtIhZXNPz7GCj
kpO9tGISCARbPLyNlKdwZNjO1HojFOzj3FyCdH8uNI9cVKLTycejnARmRKSSiCp4Y5BNTGQY
HJp0dOL19MTSzHEyLM+vtH4UBPzu+DSSfICzpNSypOzq3HcFBr+Eed3FxXclJM27uaLIxOrU
1/f19opORB9oU1KFfoRiXKh9ebGZl7rV1Dt6bMLq4nSmnGCVh8ilpRJeTAROPDRtXZdCOXE2
N38aCejb2MyZmaGDhI+0qw1oVN3t7NrMytK9xHSSjLhuYJxOUPz+/KZlYFQMCKbFvIskG8is
qJA9NkeEcnMdD3gMBeG8uGSbjP<the rest has been removed for clarity>
--------------040308020001050609000802
Content-Type: image/gif;
name="image2.gif"
Content-Transfer-Encoding: base64
Content-ID: <image2.gif>
Content-Disposition: inline;
filename="image2.gif"
R0lGODlhIAFoAdUkAP///wAAAO0gJGdkZKako/JnSTY1NGotI/eXefvJtO84K/7v5/BKM/SA
YfFZPv3WxE5LSh8fHvmvlf3i1VpYV4WCghIREXVycvaMbfijhvN0VUJAPysqKbm3t/q8pJWS
k8zKyuLg4GBgYO/v7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACQALAAA
AAAgAWgBAAb/QJJwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweEwum8/otHrNbrvf8Lh8
Tq/b7/i8fs/v+/9HIyIBhIWGh4<the rest has been removed for clarity>
--------------040308020001050609000802--
--------------040006060302020507070601--
and i don't know how to program the header with puresmtp library
Re: PureSMTP library : mail & attachments
Posted: Mon Mar 14, 2011 1:50 pm
by gnozal
loulou wrote:.....
I want only to have a mail like that
...
and i don't know how to program the header with puresmtp library
PureSMTP.chm ?
Try something like this (partial code):
Code: Select all
Define text.s
Text + "<!DOCTYPE HTML PUBLIC " + #DQUOTE$ + "-//W3C//DTD HTML 4.01 Transitional//EN" + #DQUOTE$ + ">"
text + "<html>"
text + "<head>"
text + "</head>"
text + "<body>"
text + "<div align='left'>"
text + "<p>Hi this is a message</p>"
text + "<a href='http://www.google.com'>"
text + "<img src='cid:image1.gif' alt='image1' style='border-style: none;' height='56' width='200'>"
text + "<img src='cid:image2.gif' alt='image2' style='border-style: none;' height='56' width='200'>"
text + "<br>"
text + "</a>"
text + "</div>"
text + "<u>Hola! á</u>"
text + "</body>"
text + "</html>"
PureSMTP_SetContentType("text/html; charset=iso-8859-1") ; <------ set to HTML
Attachments.s = "c:\your_path\image1.gif;c:\your_path\image2.gif"
...
PureSMTP_SendMail(MailTo, MailFrom, Subject, Text, Attachments)
Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Mon Mar 14, 2011 6:27 pm
by SunSatION
Thanks for the fix gnozal!

Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Sun Oct 09, 2011 1:29 pm
by MachineCode
Got some questions, gnozal, regarding sending multiple large files as attachments.
I'm trying to email myself 9 x 1 MB files, but only items 1 to 4 arrive, and then PureSMTP_SendMail() is returning either -3 or -6 error codes. During these 9 attempted sends, PureSMTP_OpenSMTPConnection() is always open, because I'm sending the 9 files in a For/Next loop. Should I be closing the connection between each file instead?
Or, should I be increasing PureSMTP_SetTimeOut() to something larger, like 5 minutes, so each 1 MB email has enough time to go through? Or, both?
Lastly, where does PureSMTP_SetTimeOut() go? Before or after PureSMTP_OpenSMTPConnection()? The docs don't say.
Thanks.
[Edit] Never mind, I worked it out.

I had to open and close the SMTP connection before and after each part, instead of before and after the loop.
Now it works. I also used a timeout of 3600 (one hour) to be sure, after the SMTP connection was opened, and before the send. Hopefully my experience will be of help to someone else in future.

Re: PureSMTP library : mail & attachments (AUTH supported)
Posted: Mon Dec 12, 2011 10:35 pm
by ROUMANET
Hi there !
just to know : is Pure_SMTP lib working on Win7 64 bits ?
On mine, the installer file show me a problem but help file is there... however I can't compile.
I've tried to copy from c:\Program(x86) to c:\Programmes (probably c:\Program files in english but my system is in french). Now it say me "constant not found : #PureSMTP_Ok"
I need to sent email when my program closed (to log error and prevent me that it has stop to works). Help !