[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - Forward message to cell phone via SMS

Forward message to cell phone via SMS

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Forward message to cell phone via SMS

Postby dribnus » Sun Jul 29, 2007 12:03 pm

dribnus wrote:I have recently changed carriers and phones. I am using Sprint with a Motorola Q. I have always had my emails forwarded to my phone via SMS, then I would just check my email as needed from the SMS notification. NEW PROBLEM.....my carrier, or the phone, won't accept SMS messages from an email that has an attachment. I'm trying to figure out a way to forward the email w/o the attachment. I don't need the attachment just to get the notification of the email and the text that may be there as well.
Can anyone help me with this?
Thanx.


Eric wrote:Maybe you could adapt this script: Attachment Remover to fit your needs.
See also Attachment Remover from Pete.

You'll have to use a filter to run the script on forwarded messages sent to your mobile phone.

No guarantee it will work however, but do try it out, so you'll know. :wink:


Thanx, The one Pete posted does the job, but I need to tweak it. I can't seem to figure out how to bypass the dialog of "YES,NO". I'm not real good with scripts that are this deep. Any chance of getting a little help with it? All I think I need, is to bypass the dialog. When every email comes in, I'll be copying it to a "temp" folder, then from there, running the script, then forwarding it via SMS, then deleting the entire copied email.
Thank you again for your help.

OR, is there a way in the "Options ->Sending Mail" menu to configure the "forward" option to only include text?
dribnus
Poco Enthusiast
 
Posts: 221
Joined: Fri Jul 30, 2004 3:33 am

Postby dazbo » Mon Jul 30, 2007 7:24 am

Hi I hope I've got rid of the right dialog for you.. It just assumse yes now.


Code: Select all
{ Script:  Attachment Remover.poc
{ Author:  PJR
{ Revision History:
{    08 Feb 2004 - Initial version.
{    13 Apr 2004 - Show error message if run from "Special" mailbox.
{
{ This is an "All-In-One" script that removes attachments from messages,
{ but keeps the messages.
{
{ If you run this script manually, it will ask you for confirmation to remove
{ each attachment for each of the currently selected messages.  In this mode,
{ the script will not remove any attachment from any message
{ unless you explicitly answer "Yes".
{
{ If you run it automatically (with your Incoming Filters for example), then it
{ will automatically remove all attachments from incoming messages that
{ meet the specified criteria WITHOUT ASKING YOU.
{ By default, the specified criteria is that all attachments will be removed.
{ One way to use this script in such an automatic way would be to create
{ an Incoming filter that searches "From" for "spam-domain.com" and,
{ if true, calls this script to delete all attachments from the message.
{ Or, as another example, if you don't want to receive any attachments
{ from anybody, then change the filter to search "From" for "@".
{
{ In addition to using a filter to limit which messages are affected
{ by the script (as previously described), you can also specify
{ which attachments are removed from these messages based on
{ the filenames and/or the filename extensions of the attachments.
{ You specify these conditions in the script itself
{ rather than in the filter that calls the script (there are more notes on this
{ below).
{
{ Note to PocoScripters:  I am not using the "External" command to let users
{ customize the behavior of the script because, in my opinion, that is not the
{ right tool for the job in this case.  The script uses more complex logic
{ to filter filenames and filename extensions, and it would be sloppier and
{ more difficult to specify these filters in
{ an External variable or External file.  I believe that it would be better to
{ just change the script itself.
{
{ This script will work regardless of whether or not you automatically decode
{ attachments to the Attach folder (via Tools > Options > Encoding Options).
{ If you decode attachments like this, this script will also delete
{ the corresponding disk files.
{
{ Note that this script only deletes attachments from messages that you download
{ to your computer.  In other words, you cannot use this script to delete
{ attachments or messages on the mail server by calling it from a
{ Predownload filter.  This also means that if you configure your anti-virus
{ software to scan incoming messages for viruses and remove infected
{ attachments, then this script might never get the chance to see
{ those attachments.
{
{ In its initial configuration, this script deletes attachments without
{ regard to filenames or extensions.
{ However, you can change the code in the "Filename Filter" subroutine
{ to explicitly include and exclude certain filenames and extensions.
{ The code to change is at the very end of the script.  Look for label FF_MAIN.
{
{ If you do this, then
{ including and excluding specific filenames and extensions only
{ applies when you run the script in "automatic mode" such as if you call it
{ from the Incoming filters.  In "manual mode", it will always present you with
{ *every* attachment and ask for your confirmation before deleting each one.
{ You can make manual mode work based on filenames and extensions if you
{ comment the first statement of subroutine "File Filter".

Set $OnErrorMessage ""
AddStrings $OnErrorMessage "Error in " $pocoScriptName
Set $OnErrorGoTo "POCO_ERROR"

{ Do not run if currently in a "Special" mailbox. }
StringPos #index "System.pocosys" $currentMailbox
If #index ! 0 Then SPECIAL_MAILBOX_ERROR

{ Get list of attachments for message }
ReadAttached $attachmentList %message
LineCount #attachmentListSize $attachmentList
if #attachmentListSize = 0 Then DONE

{ Determine whether user leaves attachments encoded
Set &isEncoded True
ReadHeader $tmp "X-Poco-Attachment:" %message
If $tmp = "" Then ENCODED
Set &isEncoded False

:ENCODED
ReadHeader $subject "Subject:" %message
ChopString $subject 41 999
Set $wasMessageChanged "False"
Set #i -1

{ For each attachment in the message... }
:MAIN_LOOP
Inc #i
If #i = #attachmentListSize Then SAVE
GetLine $attachmentName #i $attachmentList
Call DELETE_ROUTINE
Goto MAIN_LOOP

{ Now save the resulting message if necessary }
:SAVE
If $wasMessageChanged = "False" Then DONE
If #pocoScriptMode ! 5 Then DONE
SaveMessage %message $currentMailbox
DeleteMessage %message

:DONE
Exit

:SPECIAL_MAILBOX_ERROR
Set $tmp ""
AddStrings $tmp "Cannot remove attachments from messages in \"Special\" mailboxes.\n"
AddStrings $tmp "Please run the script from the actual mailbox (e.g. \"In\")"
MessageBox $tmp
Exit

:POCO_ERROR
Exit


{*******************************************************************************
{* Delete Routine
{*******************************************************************************
{* This subroutine deletes the current attachment, but only if all of the
{* criteria are met.
{*
{* This routine uses the global variables (unlike Filename Filter).
{*******************************************************************************
:DELETE_ROUTINE

Set $FF_filename $attachmentName
Call FILENAME_FILTER
If $FF_doDelete = "False" Then Return
If #pocoScriptMode ! 5 Then DELETE_IT
Call DELETE_IT
{Set $prompt ""
{AddStrings $prompt "MESSAGE: " $subject "\n"
{AddStrings $prompt "ATTACHMENT: \"" $attachmentName "\"\n"
{AddStrings $prompt "Do you want to delete this attachment? %var%"
{InputBox $response $prompt "Yes|No"
{If $response = "Yes" Then DELETE_IT
Return

:DELETE_IT
Set $wasMessageChanged "True"
DeleteAttached %message $attachmentName
If &isEncoded Then Return
FileExists &doesFileExist $attachmentName
If &doesFileExist Then DELETE_DISK_FILE
Return

:DELETE_DISK_FILE
DeleteFile $attachmentName
Return


{*******************************************************************************
{* Filename Filter
{*******************************************************************************
{* This subroutine determines whether the passed filename meets the criteria
{* for deletion of the attachment.
{*
{* $FF_filename (in/out) This variable should contain the filename (including
{*                       the path and extension) of the current attachment in
{*                       the message.  This subroutine removes the path from
{*                       this variable and converts the remainder to lowercase.
{* $FF_doDelete (out) This variable will be set to "True" if the current
{*                    attachment should be deleted.
{*******************************************************************************
:FILENAME_FILTER

{ When running the script in manual mode, comment the next line if you want to
{ delete attachments based on filename and extension.
{ (In manual mode, you will be prompted for confirmation
{  regardless of this setting.)
If #pocoScriptMode = 5 Then FF_DELETE

{ First, remove the path to the filename }
StringPos #FF_index \ $FF_filename
If #FF_index = 0 Then FF_PARSE_EXTENSION
ChopString $FF_filename 1 #FF_index
Goto FILENAME_FILTER

{ Second, parse the extension }
:FF_PARSE_EXTENSION
Set $FF_extension ""
Lowercase $FF_filename
Set $FF_tmp $FF_filename

:FF_EXTENSION_LOOP
StringPos #FF_index "." $FF_tmp
If #FF_index = 0 Then FF_MAIN
ChopString $FF_tmp 1 #FF_index
Set $FF_extension $FF_tmp
Goto FF_EXTENSION_LOOP

{ Finally, decide whether or not to remove this attachment. }

:FF_MAIN

{ Uncomment any of the following lines or add your own. }
{ Here are examples that check the extension:
{    If $FF_extension = "jpg" Then FF_KEEP
{    If $FF_extension = "pdf" Then FF_KEEP
{    If $FF_extension = ""    Then FF_DELETE
{    If $FF_extension = "bat" Then FF_DELETE
{    If $FF_extension = "exe" Then FF_DELETE
{    If $FF_extension = "scr" Then FF_DELETE
{ Here are examples that check the filename (and extension):
{    If "phrase one" ^ $FF_filename Then FF_DELETE
{    If "phrase two" ^ $FF_filename Then FF_KEEP
{ If no matches were found so far, then use the following default action:
Goto FF_DELETE
{Goto FF_KEEP

:FF_DELETE
Set $FF_doDelete "True"
Return

:FF_KEEP
Set $FF_doDelete "False"
Return


cheers
dazbo
dazbo
Drop-in Visitor
 
Posts: 13
Joined: Thu Dec 14, 2006 7:32 am

Postby dribnus » Mon Jul 30, 2007 9:59 am

dazbo wrote:Hi I hope I've got rid of the right dialog for you.. It just assumse yes now.



Great Job!!!!!!!!!!! Just what I needed.

BTW, thanx for doing this.
dribnus
Poco Enthusiast
 
Posts: 221
Joined: Fri Jul 30, 2004 3:33 am


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron