Hi,
Thanks a lot for the plugin Robin, but since I'm new to perl it found difficult 
for me to understand it.
If it is possible could you kindly explain that what each line is used to do.

I'll be very much grateful to you if you could kindly help me at your earliest 
convenience.
Cos' I'm in a great hurry.

I've to find a solution (plugin) to accept an email,

Extract the From address: Subject: Names of the attachments(if any): Date: 
Time: Message Body: & To Address(e.g:[EMAIL PROTECTED]): ,

Check the receiver's credit limit and whether he has activated this service. If 
either one or both fails forward the mail to his email account and drop it or 
if both of them are yes then,

Include all the extracted data except To address: into sms (160 characters per 
sms) - max sms limit is 10.,

extract the nine digits from the To address: and add a 0 in front 
(e.g:0123456789) and send the sms's to the receiver by forwarding them 
immediately or by sending them to a mail queue.

This is the procedure which the plugin is required to.
Please help me with it.
Make sure you describe the lines of the plugin with comments because I'm very 
new to perl & qpsmtpd.

Thank you.
God bless you!
Yours truly,

Dilshan Perera

----- Original Message ----
From: Robin H. Johnson <[EMAIL PROTECTED]>
To: Dilshan Perera <[EMAIL PROTECTED]>
Cc: Johan Almqvist <[EMAIL PROTECTED]>; QPSMTPD PERL.ORG <[email protected]>
Sent: Wednesday, April 11, 2007 2:53:01 PM
Subject: Re: Could someone help me to write a PLUGIN FOR E-MAIL TO SMS!


On Wed, Apr 11, 2007 at 02:02:44AM -0700, Dilshan Perera wrote:
> Hi Johan,
> First of all let me thank you for your quick response.
> 
> Actually I've been asked to do this with QPSMTPD that's why I need a
> qpsmtpd plugin, and let me complete the requirement.  The 160
> characters will be immediately forwarded to a smsc (sms client) to
> forward it to the receiver, and then look in to the next 160
> characters. The main idea is that not to keep any archive but to
> forward the requested no. of sms's and discard the mail after
> forwarding it to his mail box.
You're still going about this the wrong way. 

Find attached the shell program that I used to use with my cellphone,
before my cell-provider changed their email to SMS gateway (to always
send a very annoying message "You have recieved an email from [EMAIL PROTECTED],
reply with yes to read it")

I was originally calling it the attached program from a .qmail file,
then later procmail so that I could do some special filtering on it
first. In both cases, the email is discarded afterwards instead of
stored.

The core problem, is that there are much better tools than qpsmtpd to
select the 160 characters that you wish to send. My script simply
prepends the content of the subject line to the message, and then takes
the first 140 characters (limit of my cell provider).

-- 
Robin Hugh Johnson
Gentoo Linux Developer & Council Member
E-Mail     : [EMAIL PROTECTED]
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85
#!/bin/bash
CONFIGFILES="/etc/rogerssms ~/.rogerssms"
if [ -z $NUM ]; then
    for i in $CONFIGFILES; do
        f="$(eval echo $i)"
        [ -e $f ] && source $f
    done;
fi
if [ -z "${NUM}" ]; then
    echo "Phone number not set!" 1>&2
    exit 1
fi

TM="$(cat -)"
SPACECMD='sed "s,^[[:space:]]\+,,g;s,[[:space:]]\+, ,g;s,[\n\r], 
,g;s,[[:space:]]\+$,,g;"'
SPACECMD="tr -s '[:space:]' ' ' | ${SPACECMD} | tr -s '[:space:]' ' '"
HEADERS="$(echo -n "${TM}" | formail -X '')"
BODY="$(echo -n "${TM}" | formail -I '' | eval "$SPACECMD" |egrep -v '^$' )"
SUBJ="$(echo -n "${HEADERS}" | formail -c -x Subject | eval "$SPACECMD" )"
MSG="$(echo -ne "${SUBJ} ${BODY}" | head -c140)"

#(
##echo "Message ($SUBJ):"
##echo "---"
##echo "'${BODY}'"
##echo "---"
##echo "Length: ${#BODY}"
#echo -e "(${#MSG}) \n'$MSG'"
#) >>/tmp/rogerstest
URL='http://216.129.53.44:8080/cgi-bin/send_sm_rogers.new'
EMSG="$(echo "${MSG}" | sed 's, ,%20,g;s,\n,%09,g;s,\t,%09,g')"
#echo $MSG
#echo wget --post-data "msisdn=${NUM}&text=${EMSG}&SIZEBOX=${#MSG}" "$URL" 
>>/tmp/rogerstest
#wget --post-data "msisdn=${NUM}&text=${EMSG}&SIZEBOX=${#MSG}" "$URL" -q

smssend rogers.sms ${NUM} "${MSG}"

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to