Page 6 of 25
Posted: Fri Dec 01, 2006 11:04 am
by GeoTrail
gnozal wrote:Did you check PureSMTP_SetXMailer() ?
Yes I know about that, but that sets the xmailer setting. But when you send a mail and check the mail source you will still see Received: from PureSMPT.
gnozal wrote:I don't know php. Why do you need this ?
I send "Content-Transfer-Encoding: 7bit" for text and "Content-Transfer-Encoding: base64" for binary attachments.
Note that you can set the content type with PureSMTP_SetContentType().
Yeah I know that, but there are lots more settings that can be added with PHP. One example is sending the hostname, like geotrail.no that would help avoiding spam filter. Btw, PHP sendmail uses 8 bit for both plain text and html.
Am I asking too much now?
Thanks alot for your reply and great work gnozal. Don't mean to drown you in requests here

Posted: Fri Dec 01, 2006 11:15 am
by gnozal
GeoTrail wrote:Yeah I know that, but there are lots more settings that can be added with PHP. One example is sending the hostname, like geotrail.no that would help avoiding spam filter. Btw, PHP sendmail uses 8 bit for both plain text and html.
I have only implemented 'basic' SMTP.
To add some extra stuff I would need some examples.
GeoTrail wrote:Am I asking too much now?
Thanks alot for your reply and great work gnozal. Don't mean to drown you in requests here

No problem.
Posted: Fri Dec 01, 2006 11:48 am
by GeoTrail
Thanks again for your reply gnozal.
All I would really need is a function like this:
Code: Select all
; Add "MIME-Version: 1.0" to the header
Header.s = "MIME-Version"
String.s = "1.0"
Result = PureSMTP_SetHeader(Header.s, String.s)
; Add "X-Priority: 3" to the header
Header.s = "X-Priority"
String.s = "3"
Result = PureSMTP_SetHeader(Header.s, String.s)
; Add "X-MSMail-Priority: Normal" to the header
Header.s = "X-MSMail-Priority"
String.s = "Normal"
Result = PureSMTP_SetHeader(Header.s, String.s)
; Add "Reply-To: sender@name.com" to the header
Header.s = "Reply-To"
String.s = "sender@name.com"
Result = PureSMTP_SetHeader(Header.s, String.s)
Hopefully that will give you an idea of what I'd love to get in PureSMTP
That way I could use the PureSMTP_SetHeader function to add anything I'd need

Posted: Fri Dec 01, 2006 11:54 am
by gnozal
Are all these strings sent in the header like "Subject: " or "X-Mailer: " ?
Do they need a ": " after the string or not ?
On the todo list, something like :
- PureSMTP_AddHeader()
- PureSMTP_ClearHeader()
Posted: Fri Dec 01, 2006 11:56 am
by GeoTrail
Yes anything I would add to Header.s and String.s would be added to the header just like Subject etc.
Sweet, can I hold my breath while I wait?

hehehehe
Sorry, no need to rush, I can hold my breath for a long time hehehe

Posted: Fri Dec 01, 2006 12:35 pm
by gnozal
GeoTrail wrote:Yes anything I would add to Header.s and String.s would be added to the header just like Subject etc.
Sweet, can I hold my breath while I wait?

hehehehe
Sorry, no need to rush, I can hold my breath for a long time hehehe

Ok, new beta.
- the X-Mailer should appear in 'from ..."
- new function PureSMTP_AddHeader(Header.s, String.s) ; Set additional header strings [like "X-MSMail-Priority", "Normal"]
- new function PureSMTP_ClearHeader() ; Clear additional header strings
Code: Select all
PureSMTP_SetXMailer("ZORGONFleet")
PureSMTP_AddHeader("X-MSMail-Priority", "High")
PureSMTP_AddHeader("Reply-To", "bill@microsoft.com")
Could you test this beta lib (ANSI / PB4) :
http://people.freenet.de/gnozal/PureSMTP_BETA.zip ?
Posted: Fri Dec 01, 2006 1:46 pm
by GeoTrail
Wow, that was quick.
I'm getting this error
501 5.0.0 Invalid domain name
I've searched online for the error code and it might be an error with my ISP's smtp server. I'm gonna try to find another smtp server to try it on. Be back shortly

Posted: Fri Dec 01, 2006 2:41 pm
by GeoTrail
Just tried with another smtp server. Still getting error but two different errors this time.
One error:
Code: Select all
554 <geotrail@gmail.com>: Recipient address rejected: Relay access denied
Another error I get:
Here's the code that checks for any error:
Code: Select all
Status = PureSMTP_SendMail(Ricipient$, "Robert Olsen <geotrail@start.no>", Subject$, Message$, "")
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
Status gives me the error code -3
Does that mean anything to you?
Posted: Fri Dec 01, 2006 3:22 pm
by gnozal
Strange ... No problems here !
Error -3 means an unexpected server response, like 554 for example (transaction failed).
The code you have posted seems incomplete, because there is an error "554 <
geotrail@gmail.com>: Recipient address rejected: Relay access denied" and I don't see this address in the code. Is it Recipient$ ? If so what is exactly in Recipient$ ?
Oh, and does your code work with the non beta PureSMTP ?
I have uploaded a new version of the beta lib. It will create a 'PureSMTP.log" file to help debugging.
Posted: Fri Dec 01, 2006 3:31 pm
by GeoTrail
I've tried with several recipients, geotrail [@] gmail.com geotrail [@] start.no etc.
Yes, my code worked perfectly before the beta with user defined header function.
I'm just gonna restart my PC and then I'll try the log version.
Posted: Fri Dec 01, 2006 3:46 pm
by GeoTrail
Ok, here are the results from the two servers I've been trying it with:
--------------
RECEIVE: 220 mail49.nsc.no ESMTP Sendmail 8.13.8/8.13.5; Fri, 1 Dec 2006 15:41:46 +0100 (CET)
SEND: HELO Test email program
RECEIVE: 501 5.0.0 Invalid domain name
SEND: QUIT
RECEIVE: 221 2.0.0 mail49.nsc.no closing connection
ine.no>: Recipient address rejected: Relay access denied
SEND: QUIT
RECEIVE: 221 Bye
1 Bye
--------------
RECEIVE: 220 smtp1.powertech.no ESMTP Postfix
SEND: HELO Test email
RECEIVE: 250 smtp1.powertech.no
SEND: MAIL FROM: <
geotrail@start.no>
RECEIVE: 250 Ok
SEND: RCPT TO: <
geotrail@gmail.com>
RECEIVE: 554 <
geotrail@gmail.com>: Recipient address rejected: Relay access denied
denied
SEND: QUIT
RECEIVE: 221 Bye
1 Bye
Here's the code I used
Code: Select all
If PureSMTP_OpenSMTPConnection("smtp.online.no", 25) = #PureSMTP_Ok
MailTo.s = "Robert Olsen <geotrail@gmail.com>"
MailFrom.s = "GeoTrail Corporation <jaroolse@online.no>"
Subject.s = "Test beta lib"
MsgBody.s = "Testing a new SMTP Beta lib"
PureSMTP_SetXMailer("Test email program")
PureSMTP_SetContentType("text/plain; charset=iso-8859-1")
Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, "")
If Status = #PureSMTP_Ok
Title$ = "Success"
Msg$ = PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
Else
Title$ = "Error"
Msg$ = "Could not send message." + Chr(10) + PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
EndIf
; Close connection to SMTP server.
PureSMTP_CloseSMTPConnection()
Else
; If there was an error connecting to the SMTP server.
Title$ = "OpenSMTPConnection failed"
Msg$ = "Couldn't connect to the SMTP email server." + Chr(13)+Chr(10) + Chr(13)+Chr(10) + PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
EndIf
Posted: Fri Dec 01, 2006 3:57 pm
by gnozal
GeoTrail wrote:--------------
RECEIVE: 220 mail49.nsc.no ESMTP Sendmail 8.13.8/8.13.5; Fri, 1 Dec 2006 15:41:46 +0100 (CET)
SEND: HELO Test email program
RECEIVE: 501 5.0.0 Invalid domain name
SEND: QUIT
Do not use an X-Mailer with spaces ...
Try "TestEmail" instead of "Test EMail"
GeoTrail wrote:--------------
RECEIVE: 220 smtp1.powertech.no ESMTP Postfix
SEND: HELO Test email
RECEIVE: 250 smtp1.powertech.no
SEND: MAIL FROM: <
geotrail@start.no>
RECEIVE: 250 Ok
SEND: RCPT TO: <
geotrail@gmail.com>
RECEIVE: 554 <
geotrail@gmail.com>: Recipient address rejected: Relay access denied
denied
SEND: QUIT
I don't see anything wrong here !
"RCPT TO: <
geotrail@gmail.com>" is correct, I don't understand why the server answers with 554 ?!
Maybe the problem is that our server requires authentication and it isn't enabled.
Posted: Fri Dec 01, 2006 4:03 pm
by GeoTrail
Oh man.
Code: Select all
PureSMTP_SetXMailer("Testemailprogram")
Seemed to do the trick
It's working peeeerfectly now
Thank yous ooo much gnozal. Perfect. Just what I wanted for Xmas

Posted: Fri Dec 01, 2006 4:05 pm
by gnozal
GeoTrail wrote:Oh man.
Code: Select all
PureSMTP_SetXMailer("Testemailprogram")
Seemed to do the trick
It's working peeeerfectly now
Thank yous ooo much gnozal. Perfect. Just what I wanted for Xmas

I will add a check in PureSMTP for this to ensure it has no spaces.
Posted: Fri Dec 01, 2006 4:28 pm
by GeoTrail
Yeah that's a good idea
Just one thing, maybe you can spot something wrong here.
The first code is fine, sends html, the second sends plain text:
Code: Select all
Msg$ = "<p><b>This is the email message.</b><br />Line two?</p>"
Ricipient$ = InputRequester("Enter ricipient", "Send email to:", "Robert Olsen <geotrail@gmail.com>")
Subject$ = InputRequester("Enter subject", "Enter message subject:", "Email subject")
Msg$ = InputRequester("Enter message", "Enter email message:", Msg$)
If Subject$ <> "" And Msg$ <> "" And Ricipient$ <> ""
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
PureSMTP_SetXMailer("Testemail")
PureSMTP_SetContentType("text/html; charset=iso-8859-1")
PureSMTP_AddHeader("X-MSMail-Priority", "Normal")
PureSMTP_AddHeader("Reply-To", "geotrail@gmail.com")
Head$ = "<html><head><meta http-equiv="+Chr(34)+"Content-Type"+Chr(34)+" content="+Chr(34)+"text/html; charset=UTF-8"+Chr(34)+"><title>Gmail</title></head><body>"
Footer$ = "</body></html>"
Message$ + Head$ + Msg$ + Footer$
Status = PureSMTP_SendMail(Ricipient$, "Robert Olsen <geotrail@start.no>", Subject$, Message$, "")
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
EndIf
This second code works too, but only the first time. I have to quit the program/launch it again to be able to send it twice
Code: Select all
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
MailTo.s = "Robert Olsen <geotrail@gmail.com>"
MailFrom.s = "GeoTrail Corporation <jaroolse@online.no>"
Subject.s = "Test beta lib"
MsgBody.s = "Testing a new SMTP Beta lib"
PureSMTP_SetXMailer("Testemailprogram")
PureSMTP_SetContentType("text/plain; charset=iso-8859-1")
PureSMTP_AddHeader("X-MSMail-Priority", "High")
PureSMTP_AddHeader("Reply-To", "bill@microsoft.com")
Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, "")
If Status = #PureSMTP_Ok
Title$ = "Success"
Msg$ = PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
Else
Title$ = "Error"
Msg$ = "Could not send message." + Chr(10) + PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
EndIf
; Close connection to SMTP server.
PureSMTP_CloseSMTPConnection()
Else
; If there was an error connecting to the SMTP server.
Title$ = "OpenSMTPConnection failed"
Msg$ = "Couldn't connect to the SMTP email server." + Chr(13)+Chr(10) + Chr(13)+Chr(10) + PureSMTP_GetLastServerMessage()
MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
EndIf
I can't find the error there if there are any. Both codes work fine the first time. I have created a button for each code part. When I click the button for the first code several times after each other it works fine.
But when I do the same for the second code, it sends the message the first time I click, but the second time I click I get the error message that it cannot connect to the SMTP server. I might have missed something, that my poor old eyes can't spot
Both codes use the same smtp server and port.