PureSMTP library : mail & attachments (AUTH supported)

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

Moderator: gnozal

kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

thanks gnozal
if I was the pope
AND
if I was a believer
AND
you are/were a believer
I would beatificate you and dedicate am enforced 3 day holiday!
though Saint Gnozal doesnt really sound so nice
but hey, after all its the thought that counts
cheers
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update (PB 4.xx versions only)

Changes :
- fixed : some allocated memory wasn't freed if PureSMTP_SendMessage() was aborted from callback.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

Question

I am testing by sending large files to my mail server in sequence
I use just 1 file attachment
if I use "" as message body it gives me an error on the 4th or 5th email I send in sequence
(error -6, 354 Enter mail,end with <CRLF>.<CRLF>
if I put a body with #CRLF$ + "." + #CRLF$ fails immidiately (I assume this is the end, so I SHOULDNT send that sequence)

with any other body text, it fails at random with the same -6 error

any ideas?
I'm using PB 4.10
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

kinglestat wrote:with any other body text, it fails at random with the same -6 error any ideas?
I'm using PB 4.10
#PureSMTP_ServerTimeOut (-6) is server timeout error (maybe the server is too busy) ; try increase the timeout value with PureSMTP_SetTimeOut(TimeOut) ; TimeOut in seconds [default is 5]
NB : <CRLF>.<CRLF> is 'end of message' signal.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

thanks
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

I get this reply back from relayfax:
ERROR: SMTP ERROR

PLEASE DO NOT REPLY TO THIS MESSAGE!

The following message could not be routed by RelayFax.

This is a permanent error. This fax will not be routed and has been removed
from the outbound queue.
--- Partial Session Transcript ---
MAIL From:<test@test.com>
250 Ok
RCPT To:<true

This is a test message
501 Bad address syntax
QUIT
--- End Transcript ---
I think the problem may be the "RCPT To:<true", should this be there the "<true" bit looks strange???
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

DoubleDutch wrote:I get this reply back from relayfax:
ERROR: SMTP ERROR

PLEASE DO NOT REPLY TO THIS MESSAGE!

The following message could not be routed by RelayFax.

This is a permanent error. This fax will not be routed and has been removed
from the outbound queue.
--- Partial Session Transcript ---
MAIL From:<test@test.com>
250 Ok
RCPT To:<true

This is a test message
501 Bad address syntax
QUIT
--- End Transcript ---
I think the problem may be the "RCPT To:<true", should this be there the "<true" bit looks strange???
Yes, the "RCPT To:<true" is strange, the end of the address is missing and the server is supposed to answer after "RCPT TO:", e.g. with '250' if ok. So there is a missing CRLF after "RCPT TO:", wich is confirmed by the "501" error.
This message occured using PureSMTP ?
Iirc PureSMTP sends "RCPT TO: " + MailTo$, not "RCPT To:" !?
Could you post the code relative to PureSMTP_SendMail() ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Here it is...

Code: Select all

If PureSMTP_SendMail(emailto$,"ERAdmin <"+SMTPuser$+">","ID"+Str(id),bodytext$,"",SMTPuser$,SMTPpassword$)=#PureSMTP_Ok
  ok=#True
EndIf
emailto$ is a standard email address, but it has quotes in it, eg:
"01234 5678,Mr Jones" <myfaxserver@mydomain.com>

smtpuser$ is a stanard email/login, such as myname@mydomain.com

smtppassword$ is a simple password

bodytext$ is just standard text.

The subject is a created id number

Do you recommend anything to capture the packets, so I can email them you?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

the "RCPT To:<true" is strange
I just did a hex search and the only place your lib contains To: rather than TO: is here:
CC:.Cc: .BCC:.Bcc: .To:
This may be a clue as to whats happening?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

2DoubleDutch : I can't find an obvious reason ...
1. Does it happen with all mails or only with some, i.e. what are the values of emailto$ when it fails ?
2. Are you using PB4.20 beta 2 ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

1. Does it happen with all mails or only with some, i.e. what are the values of emailto$ when it fails ?

It's a standard email address (but with some quotes at the front), like:
"012345 23456, Mr Jones" <myfaxserver@mydomain.com>

2. Are you using PB4.20 beta 2 ?
Yes. Do you think it could be this?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Just tried it on V4.10 and the v4.10 version of the lib - same result.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Also tried the V4.10 version on XP, same problem.

I now know whats causing it though...

The beginning of the email body is:

Code: Select all

body$="CONFIRMSEND: true"+#CR$
body$+"NOCOVERPAGE: true"+#CR$
body$+"FROMNAME: Computing Data Limited"+#CR$+#CR$
If I remove this then it works fine. These initial bits are parsed by the fax server to setup some settings - I guess they are somehow messed up with the email header?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

I changed the #CR$ to #CRLF$ throughtout the body of the email and it appears to work ok now - I don't know is this is a problem with your lib or the fax server system?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gummel
User
User
Posts: 11
Joined: Sat Mar 22, 2008 11:26 am

Post by gummel »

HI Gnozal,

thanks for the very good lib, but now i found out a little problem with no solution for me:

i try to send a mail to a majordomo-mailiglist.

it looks good, but majordomo does't accept the mail, so i get no response.

i checked out diffrences between my mailer (with lib) and an other one
mailprogram (Portmailer) from which majordome accepts mails without problems.

The only diffrence was:

SMTP-Lib:

Code: Select all

From: <mail@adress.de>
To: <majordomo@test.de>
Date: 22 Mar 2008 11:12:14 UT
From: <mail@adress.de>
Subject: mm
X-Mailer: PureSMTP
Portmailer:

Code: Select all

From: mail@adress.de
To: majordomo@test.de
Date: Sat, 22 Mar 2008 11:11:05 +0100
X-Priority: 3
X-Library: Indy 8.0.22
Message-ID: <9A69.69F5445mail@adress.de>
X-Mailer: Portable Mailer
Could it be that das "<>" around the mailadresses ist the reason.

I've no trouble with this syntax before, but majordomo seems to have a spezial behavior.

Is it possible to correct the syntax?

Best wishes
Post Reply