[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 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 - Script - help!

Script - help!

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Script - help!

Postby Delanvital » Tue Aug 17, 2004 10:05 pm

tallcangal wrote:
Take a look here http://pocosystems.com/forum/viewtopic. ... ht=receipt

This will explain why PM to PM won't work for receipts.

-------------

So the solution is to use a script. I have found and downloaded a scipt from the extras section on the homepage.

I have copied the .poc-file to the scripts folder, and in the install.txt that came with the script it says I should enter a line in the events section in Poco.ini. There is no such section, so I made one and also added it to the events.ini

However, it does not respond. I can see, that I have to adjust the script in detail, but not sure how.

Can anyone here help me out? The script can be downloaded here:

http://www.pocomail.com/reg/files/scrip ... eceipt.poc

Thanks.
Delanvital
Drop-in Visitor
 
Posts: 6
Joined: Tue Aug 17, 2004 8:21 pm

Postby Michael » Wed Aug 18, 2004 2:33 am

This script was written before the days when PocoMail had a form for entering event specifications. To perform this task now:
  1. Open the Events form (Tools | Events)
  2. Change the drop down box to "Displaying message (OnDisplay)"
  3. Press the "New Event" button
  4. Change the event actioni to "Run the following script"
  5. Select the script in the "Target" drop down box.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby Andreas » Thu Aug 19, 2004 1:31 am

There is another point in that script that needs to be changed too: The "X-Poco-Status" header. Formerly, the name of this header was just "Status".

I have sent an updated version of the script to Slaven on 19 July 2003, but he never put it into the Extras area. I really don't know why.

Here is the updated version of the script:

Code: Select all
{ Script to create a return receipt message.
{
{ Author: Andreas Wosgien
{ Version: 1.4
{ Date: 19 July 2003
{
{ Description:
{ ------------
{ When you open an unread message and the sender has asked to be
{ notified when you read the message, this script will create a
{ return receipt message. A message box will inform you about that.
{ Afterwards, you can send that message, or you can delete it.
{
{ This script only runs on Poco 3.0 or later.
{
{ Installation:
{ ------------
{ Copy this file (return_receipt.poc) into the Scripts directory,
{ then in PocoMail go to Tools -> Events and make this script run
{ in case of the [OnDisplay] event.



{ If the message has already been read, there will be nothing to do.
ReadHeader $status "X-Poco-Status" %message
If "R" ^ $status Then Done


{ Read all headers of received message
ReadAllHeaders $all_message_headers %message


{ There are several possible header names by which a return receipt
{ can be requested. We put all header names into the variable
{ $all_header_names. Each header name is in a separate line.
Embed $all_header_names "@@@all_header_names"
Return-Receipt-To
Disposition-Notification-To
X-Confirm-Reading-To
@@@all_header_names


{ Prepare text for message box
Embed $message_text "@@@message_text"
The sender of this message has asked to be notified
when you read this message.

Therefore, a return receipt message will be created.

You can send that message, or you can delete it.
@@@message_text



{ Loop through all header names
LineCount #nof_lines $all_header_names
Set #curr_line 0
:Header_name_loop

   { Get current header name
   GetLine $curr_header_name #curr_line $all_header_names
   Trim $curr_header_name

   { Check whether the current header name is contained
   { in the received message's headers
   LocateLine #line_number $curr_header_name $all_message_headers False
   If #line_number < 0 Then Curr_header_not_found

      { We have found the header!
      MessageBox $message_text

      { Create return receipt message
      ReadHeader $account "X-Account:" %message
      SetAccount $account

      CreateMessage %rr_msg

      AddStrings $curr_header_name ":"
      GetLine $header_line #line_number $all_message_headers
      SubStrings $header_line $curr_header_name
      Trim $header_line
      ExtractEmail $header_line
      AddTo %rr_msg $header_line

      AddHeader %rr_msg "X-Account:" $account

      AddHeader %rr_msg "Subject:" "Return Receipt"

      Set $body "This is a return receipt for the following message:\n\n"

      ReadHeader $line "From:" %message
      InsertString $line 1 "From: "
      AppendBody $body $line

      ReadHeader $line "To:" %message
      InsertString $line 1 "To: "
      AppendBody $body $line

      ReadHeader $line "Date:" %message
      InsertString $line 1 "Date: "
      AppendBody $body $line

      ReadHeader $line "Subject:" %message
      InsertString $line 1 "Subject: "
      AppendBody $body $line

      AssignBody %rr_msg $body

      EditMessage %rr_msg

      { Exit the script. Do *not* search for further headers.
      Goto Done

   :Curr_header_not_found

   Inc #curr_line
If #curr_line < #nof_lines Then Header_name_loop



:Done
Exit
Andreas
Poco Enthusiast
 
Posts: 380
Joined: Sun Jul 25, 2004 5:30 pm
Location: Germany


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron