LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-09-2008, 02:24 AM   #1
Chrizzieej
Member
 
Registered: Jan 2007
Location: Netherlands, The
Posts: 51

Rep: Reputation: 15
SMTP script + Redhat ES 4


Hello,

I've got a perfectly running SMTP script under Redhat ES 3, but when I run it under Redhat ES 4 it doesn't work any more. Messages have got strange characters or messages are not being send at all. I don't know what the problem is, is there anyone who can tell me what the problem might be?

This is my script:

Code:
#!/bin/sh
host=****
port=25
nummer=$1
tekst=$2
    
( echo open ${host} ${port}
sleep 1
echo "HELO ****"
sleep 1
echo "MAIL FROM: ****"
sleep 1
echo "RCPT TO: ****"
sleep 1
echo "DATA"
sleep 1
echo -e "\nSUBJECT: ****\n\nCallerID=9991\nPASSWORD=9991\nSMS=$nummer\nTEXT=$tekst"
sleep 1
echo "."
sleep 1
echo "QUIT"
sleep 1
) | telnet
I've replaced IP-adresses, passwords etc. by **** offcourse The script is run through sms.sh <telnr> <message>.

Many thanks,

Greetz Chris
 
Old 06-09-2008, 05:12 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Script doesn't look "weird". What are the exact error lines you get back in the mail or on screen?
 
Old 06-09-2008, 05:59 AM   #3
Chrizzieej
Member
 
Registered: Jan 2007
Location: Netherlands, The
Posts: 51

Original Poster
Rep: Reputation: 15
When the script runs 4 times after each other, only the first message has been received. And sometimes characters have been replaced by questionmarks (?). It's very weird!
 
Old 06-09-2008, 06:42 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Whose mailserver are you using? Your own? Your ISPs? Other MTAs? Since you didn't post any exact errors or anything else to go on, about the timing, if you're not using your own MTA, try adding a sleep of say 30 seconds after each send, then decrease until you hit the threshold. Wrt the chars, comparing your input with output should show where it fails. If that's all too generic for you please post the exact error messages you receive from the MTA along with some examples from your comparison.
 
Old 06-09-2008, 07:05 AM   #5
Chrizzieej
Member
 
Registered: Jan 2007
Location: Netherlands, The
Posts: 51

Original Poster
Rep: Reputation: 15
I don't get any errors from the MTA, the strange characters only exist in the textmessage we receive on our mobile phone. This script sends a SMTP flux to our VOIP/SMS gateway. Under Redhat3 this works perfect, under Redhat4 it doesn't. I allready build in a sleep 60, then the problem with not receiving al messages is solved, but i'm still getting some change characters while the send message doesn't.
 
Old 06-09-2008, 07:22 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Do the "strange characters" also occur when you receive the message as email? Any word on the comparison part?

Last edited by unSpawn; 06-09-2008 at 08:58 AM. Reason: %s/ch/str/g
 
Old 06-09-2008, 08:00 AM   #7
Chrizzieej
Member
 
Registered: Jan 2007
Location: Netherlands, The
Posts: 51

Original Poster
Rep: Reputation: 15
Nope, I also redirected the output to a text-file which is allright so there's really nothing wrong with the output or send message! But why doesn't it work right under Redhat4 :S
 
Old 06-09-2008, 09:15 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
OK. I know you're interested to find out but you have to realise responses like "nope" (did or didn't you check receiving as email?) "nothing wrong" (on which different machines and in what ways did you check?) or "doesn't work" don't give me much to go on. So. What parts of $TEXT show "strange characters"? Separate characters, whole words, words with certain characters? Where does the text originate (log watcher, monitoring application, database)? Can you compare locale on both machines (type 'locale', save to tempfile, then diff). What happens if you convert ('man iconv') the $TEXT to 7-bit something vaguely resembling The GSM 03.38 Default Character Set (see for http://www.gammu.org/wiki/index.php?...Set_Conversion or http://smstools.meinemullemaus.de/GS...cification.pdf) or force the charset used on the RHEL-3 machine?
 
Old 06-09-2008, 09:23 AM   #9
Chrizzieej
Member
 
Registered: Jan 2007
Location: Netherlands, The
Posts: 51

Original Poster
Rep: Reputation: 15
When I send this message:

Test -> Pas op, Er zijn problemen. Was 34, Nu 36. Graag actie!!!!

Redhat 3 ES sends it perfectly, Redhat 4 ES sends it as:

Test -> Pas op, Er zijn problemen. Was ??????. Graag actie!!!!

Both machine have en_US.UTF-8 as default charset.

ps. Sorry it's a Dutch textmessage

Last edited by Chrizzieej; 06-09-2008 at 09:25 AM.
 
Old 06-10-2008, 05:06 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Great! That covers two out of four questions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP testing script jamesbitcoop Linux - General 5 06-03-2007 01:09 PM
SMTP/MX Check Expect Script rk4k Programming 2 02-06-2007 09:36 PM
script to make a remote smtp transaction pseudo.sanity Programming 8 12-21-2006 04:17 PM
SMTP/POP Pipe to PHP Script Wolfmann Linux - Enterprise 0 12-22-2005 01:23 PM
SMTP on Redhat 9 Mikeventer Linux - Newbie 1 06-01-2004 02:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration