send/header command fails
[1/10] from: ben:brannen:g:mail at: 19-Aug-2009 16:06
I've been trying to incorporate some email into a program I've written
that checks web-sites.
header: system/standard/email
header/To: ben.brannen-xxxxxxxx.com
send/header header/to "message" header ;;works
if I set:
header/Subject: "any change here or" ;; fails
header/From: "[any change here or]" ;; fails
header/Content: "any change here" ;; fails
--have not tried changing other lines yet
fails with:
** User Error: ESMTP: Invalid command
** Near: insert smtp-port reduce [from reduce [addr] tmp]
using sdk 2.7.6 rebolcmdview
-ben
[2/10] from: compkarori:gm:ail at: 20-Aug-2009 12:31
What happens when you do a trace/net on ?
What's the difference?
On Thu, Aug 20, 2009 at 9:06 AM, Ben Brannen<ben.brannen-gmail.com> wrote:
> I've been trying to incorporate some email into a program I've written
> that checks web-sites.
<<quoted lines omitted: 14>>
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
--
Graham Chiu
http://www.synapsedirect.com
Synapse - the use from anywhere EMR.
[3/10] from: ben:brannen:gm:ail at: 20-Aug-2009 10:03
I was able to narrow in on it a bit (after a good night sleep) and
using the trace/net on function. Thanks Graham.
at the command line:
header: system/standard/email
header/To: [ben.brannen-xxxxxxxxxxx.com]
>> probe header
make object! [
To: [ben.brannen-xxxxxxxxx.com]
CC: none
BCC: none
From: none
Reply-To: none
Date: none
Subject: none
Return-Path: none
Organization: none
Message-Id: none
Comment: none
X-REBOL: "View 2.7.6.3.1 http://WWW.REBOL.COM"
MIME-Version: none
Content-Type: none
Content: none
]
>>
>> send/header header/to "message" header
>>
>> probe header
make object! [
To: [ben.brannen-xxxxxxxx.com]
CC: none
BCC: none
From: {Benjamin Brannen (commercial) <ben.brannen-xxxxxx.com>}
Reply-To: none
Date: "Thu, 20 Aug 2009 09:54:25 -0500"
Subject: none
Return-Path: none
Organization: none
Message-Id: none
Comment: none
X-REBOL: "View 2.7.6.3.1 http://WWW.REBOL.COM"
MIME-Version: none
Content-Type: none
Content: none
]
>>
>> send/header header/to "message" header
** User Error: ESMTP: Invalid command
** Near: insert smtp-port reduce [from reduce [addr] tmp]
>>
>>
Notice the From line is being set. I'm trying to pre-set it to the
name of the server/website (configurable by a text file). However, it
won't let me set the From address. When I tried to disregard it, it
fails unless I set it back to 'none. But then it just sends out my
address - which makes no sense to the recipient.
Any suggestions?
-ben
On Wed, Aug 19, 2009 at 7:31 PM, Graham Chiu<compkarori-gmail.com> wrote:
[4/10] from: ben:brannen::gmail at: 20-Aug-2009 10:35
sorry .... forgot to answer the original question:
whats the difference with trace/net on?
(series of 'xx' replace private data)
---------------------------------------------------
>> probe header
make object! [
To: [ben.brannen-xxxxxxxxx.com]
CC: none
BCC: none
From: none
Reply-To: none
Date: "Thu, 20 Aug 2009 09:54:25 -0500"
Subject: none
Return-Path: none
Organization: none
Message-Id: none
Comment: none
X-REBOL: "View 2.7.6.3.1 http://WWW.REBOL.COM"
MIME-Version: none
Content-Type: none
Content: none
]
>>
>>
>> trace/net on
>> send/header header/to "message" header
Net-log: ["Opening" "tcp" "for" "esmtp"]
Net-log: [none "220"]
Net-log: {220 xxxxxxxxxxxxxxxxxxxxxxxxxx}
Net-log: [["EHLO" system/network/host] "250"]
Net-log: "250-xxxxxxxxxxxxxxxxxxxxxxxx"
Net-log: "250-AUTH LOGIN"
Net-log: "250-8BITMIME"
Net-log: "250 SIZE"
Net-log: ["Supported auth methods:" [login]]
Net-log: ["MAIL FROM: <ben.brannen-xxxxcomercialAcctxxxxx.com>" "250"]
Net-log: "250 Ok"
Net-log: ["RCPT TO: <ben.brannen-xxxxxxxxxxxxx.com>" "250"]
Net-log: "250 Ok"
Net-log: ["DATA" "354"]
Net-log: {354 Enter mail, end with "." on a line by itself}
Net-log: [none "250"]
Net-log: "250 Ok"
Net-log: ["QUIT" "221"]
Net-log: {221 xxxxxxxxxxxxxxxxxxxx Closing transmission channel}
>> send/header header/to "message" header
Net-log: ["Opening" "tcp" "for" "esmtp"]
Net-log: [none "220"]
Net-log: {220 xxxxxxxxxxxxxxxxxxxx, Inc. All rights reserved. Read
y}
Net-log: [["EHLO" system/network/host] "250"]
Net-log: "250-xxxxxxxxxxxxxxxxxxxxxxx"
Net-log: "250-AUTH LOGIN"
Net-log: "250-8BITMIME"
Net-log: "250 SIZE"
Net-log: ["Supported auth methods:" [login]]
** User Error: ESMTP: Invalid command
** Near: insert smtp-port reduce [from reduce [addr] tmp]
>>
however, if I pre-set the From address I receive the same error.
------------------------------------
On Thu, Aug 20, 2009 at 10:03 AM, Ben Brannen<ben.brannen-gmail.com> wrote:
[5/10] from: ben:brannen:g:mail at: 20-Aug-2009 10:38
sorry .... forgot to answer the original question:
whats the difference with trace/net on?
(series of 'xx' replace private data)
---------------------------------------------------
>> probe header
make object! [
To: [ben.brannen-xxxxxxxxx.com]
CC: none
BCC: none
From: none
Reply-To: none
Date: "Thu, 20 Aug 2009 09:54:25 -0500"
Subject: none
Return-Path: none
Organization: none
Message-Id: none
Comment: none
X-REBOL: "View 2.7.6.3.1 http://WWW.REBOL.COM"
MIME-Version: none
Content-Type: none
Content: none
]
>>
>>
>> trace/net on
>> send/header header/to "message" header
Net-log: ["Opening" "tcp" "for" "esmtp"]
Net-log: [none "220"]
Net-log: {220 xxxxxxxxxxxxxxxxxxxxxxxxxx}
Net-log: [["EHLO" system/network/host] "250"]
Net-log: "250-xxxxxxxxxxxxxxxxxxxxxxxx"
Net-log: "250-AUTH LOGIN"
Net-log: "250-8BITMIME"
Net-log: "250 SIZE"
Net-log: ["Supported auth methods:" [login]]
Net-log: ["MAIL FROM: <ben.brannen-xxxxcomercialAcctxxxxx.com>" "250"]
Net-log: "250 Ok"
Net-log: ["RCPT TO: <ben.brannen-xxxxxxxxxxxxx.com>" "250"]
Net-log: "250 Ok"
Net-log: ["DATA" "354"]
Net-log: {354 Enter mail, end with "." on a line by itself}
Net-log: [none "250"]
Net-log: "250 Ok"
Net-log: ["QUIT" "221"]
Net-log: {221 xxxxxxxxxxxxxxxxxxxx Closing transmission channel}
>> send/header header/to "message" header
Net-log: ["Opening" "tcp" "for" "esmtp"]
Net-log: [none "220"]
Net-log: {220 xxxxxxxxxxxxxxxxxxxx, Inc. All rights reserved. Read
y}
Net-log: [["EHLO" system/network/host] "250"]
Net-log: "250-xxxxxxxxxxxxxxxxxxxxxxx"
Net-log: "250-AUTH LOGIN"
Net-log: "250-8BITMIME"
Net-log: "250 SIZE"
Net-log: ["Supported auth methods:" [login]]
** User Error: ESMTP: Invalid command
** Near: insert smtp-port reduce [from reduce [addr] tmp]
>>
however, if I pre-set the From address I receive the same error.
------------------------------------
On Wed, Aug 19, 2009 at 7:31 PM, Graham Chiu<compkarori-gmail.com> wrote:
[6/10] from: compkarori:g:mail at: 21-Aug-2009 8:39
try
header: make system/standard/email [ from: holder-rebol.com ]
Also, check the source for prot-esmtp.r in the source directory of your SDK.
On Fri, Aug 21, 2009 at 3:38 AM, Ben Brannen<ben.brannen-gmail.com> wrote:
> sorry .... forgot to answer the original question:
> whats the difference with trace/net on?
> (series of 'xx' replace private data)
> ---------------------------------------------------
--
Graham Chiu
http://www.synapsedirect.com
Synapse - the use from anywhere EMR.
[7/10] from: santilli:gabriele:gma:il at: 20-Aug-2009 23:23
On Thu, Aug 20, 2009 at 5:38 PM, Ben Brannen<ben.brannen-gmail.com> wrote:
> sorry .... forgot to answer the original question:
> whats the difference with trace/net on?
> (series of 'xx' replace private data)
SEND assumes, perhaps incorrectly, that the From field in the header
is of type email!.
You could change system/user/name and system/user/email instead to get
a better From line in your message.
Regards,
Gabriele.
[8/10] from: ben:brannen:g:mail at: 21-Aug-2009 11:25
Thanks everyone for the help. Several replies helped me out.
* trace/net on function so I could see whats going on. Thanks Graham
* and the comment by Gabriele...
...SEND assumes...that the From field in the header is of type
email!....Thank you. I was able to work around this.
I'll also look into the mezz function if I get time. Thanks for the code Tim.
-ben
On Thu, Aug 20, 2009 at 4:23 PM, Gabriele
Santilli<santilli.gabriele-gmail.com> wrote:
[9/10] from: compkarori:gmai:l at: 25-Aug-2009 12:04
Ben
Try this .. in prot-esmtp.r replace the existing insert function with
this one so that you can set the from header to
{web server <someone-rebol.com>}
insert: func [
"INSERT called on port"
port "Opened port"
data
] [
if string? data/1 [
use [ e ][
either parse/all data/1 [ thru "<" copy e to ">" to end ][
if error? try [ data/1: to-email e ][
net-error "ESMTP: invalid from address"
]
][ net-error "ESMTP: invalid from address" ]
]
]
if not all [
block? :data
parse data [email! into [some email!] string!]
][net-error "ESMTP: Invalid command"]
confirm-command port ["MAIL FROM: <" data/1 ">"]
foreach addr data/2 [
confirm-command port ["RCPT TO: <" addr ">"]
]
net-utils/confirm port/sub-port data-check
system/words/insert port/sub-port replace/all copy data/3 "^/." "^/.."
system/words/insert port/sub-port "."
net-utils/confirm port/sub-port write-check
]
On Sat, Aug 22, 2009 at 4:25 AM, Ben Brannen<ben.brannen-gmail.com> wrote:
> Thanks everyone for the help. Several replies helped me out.
> * trace/net on function so I could see whats going on. =A0Thanks Graham
<<quoted lines omitted: 27>>
>>
>>
--
Graham Chiu
http://www.synapsedirect.com
Synapse - the use from anywhere EMR.
[10/10] from: tim-johnsons::web::com at: 20-Aug-2009 12:59
* Ben Brannen <ben.brannen-gmail.com> [090820 07:47]:
> sorry .... forgot to answer the original question:
> whats the difference with trace/net on?
<<quoted lines omitted: 18>>
> Content: none
> ]
Ben, 'send has got some gotchas in it. In some cases, making a
reference to an object rather than a specific 'copy can cause an
error. Send is a mezzanine function. That is, it is written in rebol,
not native C. This means that you can source the function, copy the
code, do a probe on the data structure that's being sent to the
port.
Example:
either only [
address: copy address
remove-each value address [not email? :value]
message: head insert insert tail net-utils/export header-obj newline message
content: reduce [from address message] ;; added
probe content added
;; change insert smtp-port reduce [from address message]
insert smtp-port content
;; might seem a little cumbersome, but might lead to a new 'send :)
HTH
tim
--
Tim
tim-johnsons-web.com
http://www.akwebsoft.com
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted