Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

cgi question

 [1/12] from: kpeters::mvinc::net at: 5-May-2004 22:46


Hi all, (REBOL on FreeBSD and Linux) I can send mail to the two obscured email addresses in the script below from REBOL command w/o any problems. The send/header below however always fails. Anything obvious this newbie might be doing wrong? How can I test what exactly the problem is if not obvious to you gurus? Thanks as always for all help!! Kai REBOL [] response: "test" recipient1: [kpeters--xxx--net] recipient2: [kpeters--xxx--com] header: make system/standard/email [ To: [ recipient1 ] From: [ [web--xxx--com] ] Subject: "subject" Organization: "organization" ] either error? try [ send/header reduce[ recipient1 recipient2 ] response header] [ web-response: { NOT ok! } write/append %errorlog.txt response ] [ web-response: { ok } ] print web-response

 [2/12] from: carl:cybercraft at: 6-May-2004 8:13


On 06-May-04, Kai Peters wrote:
> Hi all, > (REBOL on FreeBSD and Linux)
<<quoted lines omitted: 5>>
> Thanks as always for all help!! > Kai
Try taking the From email out of the block. ie... From: [web--xxx--com] At a guess, I think that'll be your problem.
> REBOL [] > response: "test"
<<quoted lines omitted: 17>>
> ] > print web-response
-- Carl Read

 [3/12] from: antonr:lexicon at: 7-May-2004 2:03


Should be send/only

 [4/12] from: kpeters:mvinc at: 6-May-2004 9:03


Carl - thanks - removing the 'From:' line seems to do the trick. Do you or anyone else have a clue as to why though? After all, I should be able to send mail from the same sender to multiple recipients... Thanks, Kai

 [5/12] from: Gary:Jones:usap:gov at: 7-May-2004 10:43


From: Kai Peters KP> I can send mail to the two obscured email addresses in the KP> script below from REBOL command w/o any problems. The KP> send/header below however always fails. Anything obvious this KP> newbie might be doing wrong? How can I test what exactly the KP> problem is if not obvious to you gurus? .... Hi, Kai, I reached a little different conclusion than the others. What struck me most was the *formatting* of your script. When I ran you script (using valid addresses of course), I confirmed errors after: header: make system/standard/email and after: either error? try [ send/header reduce[ recipient1 recipient2 ] response header] What puzzles me then is that you reported that fixes like removing "from" worked. Did you change the formatting after that? Said differently, when I changed the formatting such that the block start ("[") followed on the line (unfortunately, at least 1 line will likely wrap): REBOL [] response: "test" recipient1: [kpeters--xxx--net] recipient2: [kpeters--xxx--com] header: make system/standard/email [ To: [recipient1 ] From: [ [web--xxx--com] ] Subject: "subject" Organization: "organization" ] either error? try [send/header reduce [recipient1 recipient2] response header][ web-response: { NOT ok! } write/append %errorlog.txt response ][ web-response: { ok } ] print web-response It ran without error. However, I think as may be suggested indirectly by others, you may wish to achieve a different effect, depending on your goals. Comments I would like to make include: In your code (with the formatting fixes), the "From" is only necessary if this designation is different from what is your REBOL default (found in user.r file). I believe that the "To" may be setting what is supposed to be multiple email addresses to one (send looks to see if the "to" field is set). If you try this reformatted version, but only one address receives the email, simply try leaving the "To:" field off the header, like: header: make system/standard/email [ From: [ [web--xxx--com] ] Subject: "subject" Organization: "organization" ] Again, "From" may not be necessary either. I hope that my view does not confuse issues. I just wanted to share that I "saw" a potentially different (and more basic) problem than the others in regards to the formatting. If the formatting was actually changed by your client or through the email system, then my information may be of less use. Does this make sense? --Scott Jones

 [6/12] from: kpeters:mvinc at: 6-May-2004 20:12


Scott ~ I have tried so many different variations of scripts (the posted mini-script was just part of a bigger one on a production server) that I have lost track of what might have or what not have worked :( After a lot of debugging with trace and echo (boy, does trace ever spew out info!) I found the culprit: I had added a second email address in order to cc someone with web survey mail. I am running qmail on all my servers and I had not added that domain in qmail's rcpthosts file and so send generated a '553' error and the try failed. So my best guess is that I must not have tried that particular email address interactively... As for the described formatting issues: You see me confused, for the script works well with 'my' formatting (am coming from C and Pascal and have always wanted my braces and begin/end pairs lined up nicely). I thought I read somewhere that REBOL is very lenient when it comes to white space etc. including CR/LF etc.? Thanks as always for your very elaborate reply! Cheers, Kai Jones, Scott wrote:

 [7/12] from: greggirwin:mindspring at: 6-May-2004 23:25


Hi Kai, KP> You see me confused, for the script works well with 'my' formatting (am KP> coming from C and Pascal and have always wanted my braces and begin/end KP> pairs lined up nicely). I thought I read somewhere that REBOL is very KP> lenient when it comes to white space etc. including CR/LF etc.? Don't be confused, REBOL doesn't care at all about the formatting. It's only when the formatting hides the errors (e.g mismatched brackets) that it matters. :) Of course, sometimes having at least *one* space between tokens is important in REBOL, where it might not be in other languages. The REBOL style guide isn't a bad starting point in any case, if other REBOLers are going to look at it. -- Gregg

 [8/12] from: carl:cybercraft at: 7-May-2004 10:30


On 07-May-04, Kai Peters wrote:
> Carl - > thanks - removing the 'From:' line seems to do the trick. Do you or > anyone else have a clue as to why though? > After all, I should be able to send mail from the same sender to > multiple recipients...
Well, a To: block for multiple recipients makes sense, but there's only one sender, so a block for From: doesn't make sense. (At least not to me, anyway. Can anyone think of a reason for multiple sender addresses?) -- Carl Read

 [9/12] from: SunandaDH:aol at: 7-May-2004 3:01


Kai:
> You see me confused, for the script works well with 'my' formatting (am > coming from C and Pascal and have always wanted my braces and begin/end > pairs lined up nicely). I thought I read somewhere that REBOL is very > lenient when it comes to white space etc. including CR/LF etc.?
As Joel says when kicking of a detailed discussion on the subject: source layout can be a "controversial and sensitive subject" http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlBQFK http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlGCFK I'm more of a "style C" person myself. But there is a lot to be said for experimenting with alternatives Sunanda.

 [10/12] from: Gary:Jones:usap:gov at: 8-May-2004 7:35


From: Kai Peters KP> You see me confused, for the script works well with 'my' formatting (am KP> coming from C and Pascal and have always wanted my braces and begin/end KP> pairs lined up nicely). I thought I read somewhere that REBOL is very KP> lenient when it comes to white space etc. including CR/LF etc.? From: Gregg Irwin GI> Don't be confused, REBOL doesn't care at all about the formatting. .... With all due respect, I am not a formatting elitist, either, and was not meaning to sound critical of Kai's formatting. In retrospect, the point I failed to make is that when cutting and pasting into a REBOL command line session, one can run into formatting issues. Here is an example from Kai's program, when a snippet is cut and pasted into a REBOL session (at least on Windows):
>> header: make system/standard/email
** Script Error: Invalid argument: (missing value) ** Near: header: make system/standard/email
>> [
[ To: [ recipient1 ] [ From: [ [web--xxx--com] ] [ Subject: "subject" [ Organization: "organization" [ ] == [ To: [recipient1] From: [[web--xxx--com]] Subject: "subject" Organization: "organization" ] The same snippet runs without error when in a listing that is then run as a program. I frequently develop scripts by cutting and pasting from a text file into the command line. I can get large code fragments loaded, so that I can then play with the results interactively. With this method, at least on windows, REBOL *does* care about formatting. As a result I tend to make sure that block arguments at least have the opening bracket start on the same line. This is why I have so frequently warned of "watch for line wrap" when responding to email on the list: cutting and pasting the fragment may not work if the line received an "unfortunate" wrap location. I *just* realized that I sort of assumed everyone developed using these methods, and in that point I was being unfortunately narrow sighted. I apologize! With respect, best wishes to all! Happy REBOLing however one wishes to format. --Scott Jones

 [11/12] from: greggirwin:mindspring at: 7-May-2004 17:18


Hi Scott, JS> In retrospect, the point I failed to make is that when cutting and pasting JS> into a REBOL command line session, one can run into formatting issues. AH, yes! A truly excellent point! Very, very important indeed. -- Gregg

 [12/12] from: antonr:lexicon at: 9-May-2004 0:58


Hi, I was wrong about send/only, but now I have a comment about how you made the header. You should be sure that your To: field block is reduced. So check that after making the header, The To: field isn't still just an unreduced block with 'recipient1 in it. Look:
>> header: make system/standard/email [To: [recipient1]] >> ?? header
header: make object! [ To: [recipient1] ;;;; <<<---- :-( 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 1.2.46.3.1 http://WWW.REBOL.COM" MIME-Version: none Content-Type: none Content: none ] In the above console session, I had not even set 'recipient1 yet, and make had no complaint about it! It should be: header: make system/standard/email [To: reduce [recipient1]] Now it correctly goes looking for the value of 'recipient1. A more powerful way of catching errors: either error? set/any 'err try [ ; your code ][ ; An error happened. Now err is an error! object. print mold disarm err ][ ; everything went ok ] Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted