Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
once upon a time long ago, i kludged together a custom script for use with UBB.c 6.5.0 that was simple email wrapper. Submit a static html form and send the info the user filled out to an email addy. I was 110% perl idgit when i kludged that together. But it worked, and was such a painfully experience i swore i'd never touch anything with a .cgi extension ever again.

ha! fast forward several years, my second ubb.c site comes along and I actually get halfway good at doing ubb.c mods, and vastly improve myself so that I'm currently only a 87.5% perl idgit smile

and alas oh whoa is me - i need the same lil band-aid trick to submit a static html form and run thru my ubb.c email utilites. so I took my old 6.5.0 custom script, compared it to a 6.7.2 custom i wrote recently using Alan's generic portal/index page mod and attempted to redo my old rox_mail_wrap.cgi to make it 6.7.2 compatible.

and yeah you prolly guessed it if ya'all remember all my painfully clueless questions from long past... i failed miserably! i failed big! i failed everywhich way possible!! oh my, it was quite the error message extravaganza... 18 pages long on a printout.

but after a day, I fiddled diddled it down to a half page error msg shown here: http://dragboatalley.com/images/hateperl.jpg

can anyone look at that gobblygook and gimme a clue what i might need to do to make $alpha_threads confuddlement go away?

TIA!!!


Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
hmm.. have you tried adding $alpha_threads to the globals statement up top?


- Allen wavey
- What Drives You?
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
"global statement up top" ... do you mean the stuff inside of this: use vars qw( ... );

is that global vars?

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
yes smile

Charles worked to get the forum to run in strict mode and that's part of it smile


- Allen wavey
- What Drives You?
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
ah ha! no error msg... but not quite there yet. now it gives me the std "FYI" page with following msg

Quote
You are using a function that requires email to be sent. It appears that the board administrator has not yet configured the email settings. Please ask him to do so. Thank you!

so i guess the mail lib prolly got changes in it too (sigh) here's a copy of my custom script (this looks wacky in browser but displays fine in notepad if dload'd): http://dragboatalley.com/rox_mail_wrap.txt

see any blatantly obvious booboos in there? or can you point me at any similar send to email code in 6.7.2 that i can use an example to re-kludge this from? TIA!!!

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
You might try a file-compare between the 6.5 mail lib and the 6.7.3 version smile


- Allen wavey
- What Drives You?
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
ok thats a mind numbing exercise that will take a perl idgit like me a long while to figure my thru... meanwhile I'm still looking at my redone 6.5 script vs. newer my custom script for stupid mistakes and i see two things make me say "hmmmmm...."

1) in my global vars i have mention of @benches and thats sumthin i dont remember ever seeing in 6.7x stuff before. is it necessary?

2. very end of the script i dont got a 1; like my newer script does on the the last line. is that necessary?

tks again

Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
ok i put in the 1; and the end of my redone script, plus added a no strict; right before email processing like i see done in other places in 6.7.2 where it sends off an email and I'm still getting the FYI message that email isnt config'd

now i suspect the goofy non-standard mail server config (another almighty motherload kludge) i have going on might be my problem. I'm on a Win2000 server with CommunigatePro mail server, and use their sendmail.exe for my ubb email config. Yup - i said that right... i use sendmail on Windows platform. the reasons why will make your head hurt and eyes glaze over so hopefully i dont have to go there wink but up until this custom script adventure, it worked just fine.

so here's what my vars_email.cgi looks like
Code
%vars_email = (
q!EmailServer! => q!mail.dragboatalley.com!,
q!SMTPEmail! => q!Off!,
q!SendMailLocation! => q!c:\websites\ubb6_nappmembers\cgi-bin\sendmail.exe!,
q!UBBFriendUSE! => q!ON!,
q!UseDashF! => q!ON!,
q!UseEmail! => q!ON!,
q!UserMailPref! => q!ON!,
q!email_format! => q!ascii!,
);

and here's where my errant FYI message is coming from in ubb_lib_mail.cgi
Code

# figure out which method we're using
if ($vars_email{SMTPEmail} eq 'On') {
# SMTP
MIME::Lite->send('smtp', "$vars_email{EmailServer}");
} elsif(($vars_email{SendMailLocation} ne "") && (&FileExists($vars_email{SendMailLocation}))) {
# Sendmail
my $dashf = $vars_email{'UseDashF'} ne "OFF" ? " -f $params->{EmailFrom}" : "";
MIME::Lite->send('sendmail', "$vars_email{SendMailLocation} -t -oi$dashf");
} else {
# No SMTP, no sendmail, no mail for you!
&StandardHTML($vars_wordlets_err{tell_admin_to_config_email});
exit;
} # end if

only diff i see in beyondcompare for 6.5 vs. 6.7.2 is the my $dashf line. and i dbl chkd SendMailLocation is correct. anybody see any reason while this aint working for me when used with my custom script??? TIA!

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Could be a bug with the sendmail app then, maybe it doesn't support UseDashF? Are there updates for it available?


- Allen wavey
- What Drives You?
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
yeah but that same routine is sending mail just fine from everywhere else in my ubb (i chk'd password request, PM notification and registration notification).

so surely it's something whacked in my rox_mail_wrap.cgi script that i originally wrote for 6.5

I keep going over it, comparing it to my other 6.7.2 custom script to see whats not right... the one thing i found was i had a sub RequireCode in there, but nowadays thats in ubb_lib so i took it out. still get the errant email not config'd message. it's almost seems like my global %vars_email stuff isnt being seen correctly by the time i call &ubb_mail_tng.

i also see this suspicion bit in my script that doesnt seem to be 6.7.2 standard:
Code
# flush stdout buffer 
$| = 1;

is that something i should perhaps get rid of?

Sponsored Links
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
oh brother... i'm so lost i've become anonymous smile

~=Rox

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
hehe, bug in beta 1, beta 2 should be out soon.

hmm, in looking at your file I don't see where you required the vars_email.cgi file - you might try that first.


- Allen wavey
- What Drives You?
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
inside of my use vars qw( ... ); at the top of my script i have mention of %vars_email

is that where it belongs, or do i need to use it in a &RequireVars() or &RequireCode() call?

or is it too far up... do i maybe need to reference vars_email down in the sub Send_mail_patch instead at the beginning?

TIA and tks again!!

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
no, you need it in the use vars statement, but if I were you I'd have a little further down with the other &RequireVars statements a require for the vars_email.cgi file.


- Allen wavey
- What Drives You?
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
thankyou thankyou thankyou! &RequireVars on vars_email.cgi fixed me! whew!!!

Lesson learned - next time i get inclined to wrastle a custom script, i'm heading straight to "developers for hire" forum instead of mustering the bravado to kludge-it-myself! wink

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
glad it's working for you now smile


- Allen wavey
- What Drives You?
Joined: Feb 2003
Posts: 179
Member
Member
Offline
Joined: Feb 2003
Posts: 179
just to follow thru on this topic and 'splain what i did in case somebody searches it up someday and wants to do something similar...

I created a vendor sign-up form for one of the free services on my site (Daily Spotlight... a rotating photo showcase thats rss-driven)

http://dragboatalley.com/spotform.htm

the form action points to my custom rox_mail_wrap.cgi script that reads in the form fields, assembles an email, and sends it off to me. The visitor gets a standard transition page and then dumped back off at my portal home page. Fairly simple, only trick i did to save a few lines of scripting was made the send-to addy and email subject hidden form fields.

The gist of the script is shown here:
http://dragboatalley.com/rox_mail_wrap.txt

the only thing i tweaked from whats shown above is how the actual message part of the email is assembled. this little bit of the script didnt gimme a clean list of "fieldname = value" lines like i thought it would frown

Code
 	# build message string
foreach my $key (%in) { $message .= "$key = $in{$key}\n"; }

now if i ever need to reuse this script with another form, I'll revisit that bit of generic-message-assembly logic and figure it out rightly. but for time being i took a shortcut and just hardcoded the formfield names and concatenated my email message text like this:

Code
	$message = "company = $in{'company'}\n";
$message .= "Member = $in{'memberid'}\n";
$message .= "URL = $in{'siteurl'}\n";
$message .= "Salespitch = $in{'pitch'}\n";
$message .= "Contact block = $in{'contact'}\n";
$message .= "Spotlight Plan = $in{'plan'}\n";
$message .= "Notes = $in{'notes'}\n";


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)