Jump to content

tires

Members
  • Posts

    236
  • Joined

  • Last visited

Everything posted by tires

  1. It seems to continue there! Great!!!
  2. I have just realized that the module is still running with my new mailboxes. The problem was that I have several mailboxes that I retrieve. And since there is only one field for the password, this must be the same for all mailboxes ...
  3. With my new mail server, this module no longer works for me either. That's a real shame, because it's a great and helpful module. I assume that you only have to replace the flourish components with the imap_open function. Most of the code should remain untouched. I also lack the technical expertise. The AI suggests the following code: <?php /** * ProcessEmailToPage.module * Module to fetch emails from a mailbox and convert them into ProcessWire pages */ class ProcessEmailToPage extends WireData implements Module { public $moduleHash; public $emailHost; public $emailPort; public $emailPassword; public $emailType; public $forceSecure = false; public $categoryData; // Module info public static function getModuleInfo() { return array( 'title' => 'Process Email to Page', 'version' => 1, 'summary' => 'Fetches emails from a mailbox and creates pages from the messages.', 'author' => 'Your Name', 'requires' => 'ProcessWire 3.x' ); } public function init() { // Set the hash for security to ensure only authorized requests are processed $this->moduleHash = wire('config')->hash; // Example category data (JSON) $this->categoryData = '{"categories": [{"emailAddress": "your-email@example.com"}]}'; // Set connection parameters $this->emailHost = 'imap.example.com'; // Example IMAP server $this->emailPort = 993; // SSL port $this->emailPassword = 'your-password'; // Your email password $this->emailType = 'imap'; // Protocol type (imap/pop3) } public function execute() { // Process emails if the correct hash is provided if(wire('input')->get('hash') && wire('input')->get('hash') == $this->moduleHash) { // Decode category data from JSON into an object $categories = json_decode($this->categoryData); // Iterate through each email category foreach($categories as $category) { // Set up email connection $this->emailType = empty($this->emailType) ? 'imap' : strtolower($this->emailType); // Default to 'imap' $server = '{' . $this->emailHost . ':' . ($this->emailPort ? $this->emailPort : 993) . '/imap/ssl}INBOX'; // IMAP server with SSL $username = $category->emailAddress; $password = $this->emailPassword; // Connect to the mail server using imap_open $mailbox = imap_open($server, $username, $password); if (!$mailbox) { echo "Error connecting to the mail server: " . imap_last_error(); continue; } // Search for all emails (can be adjusted to 'UNSEEN' for unread emails) $emails = imap_search($mailbox, 'ALL'); if ($emails) { rsort($emails); // Sort emails with the newest first $messages = []; // Iterate through each email ID foreach($emails as $email_id) { // Fetch the email header information $overview = imap_fetch_overview($mailbox, $email_id, 0); $messages[] = $overview[0]; // Store header information // Optional: Output more header fields such as "From", "Subject", "Date" // echo "Subject: " . $overview[0]->subject . "\n"; // echo "From: " . $overview[0]->from . "\n"; // echo "Date: " . $overview[0]->date . "\n"; } // Now process the emails, for example, create a page for each email foreach ($messages as $message) { $page = $pages->add('email'); $page->title = $message->subject; $page->body = "Email from: " . $message->from . " on " . $message->date; $page->save(); } // Delete processed emails from the server foreach ($emails as $email_id) { imap_delete($mailbox, $email_id); } // Expunge to permanently remove the deleted emails imap_expunge($mailbox); } // Close the connection to the mail server after processing imap_close($mailbox); } } } }
  4. Thank you very much. I have now simply removed this hook.
  5. Please, come on! 😆 Really, i don't understand what you mean right now.
  6. Which mistake do you mean? 🤓 By the way, do I need this hook at all or does the module automatically index the edited page when it is saved?
  7. having had a lot of frustration during the year creating two shops with shopware 6, i wonder if there is an open source shop system that is as nice and simple as processwire? Do you have any experience with a system with a wide range of functions that is easy to set up and use (apart from padloper and RockCommerce)?
  8. I can't really remember why I used this module (it's been a few years). Do I really need it to find the content of the pages? You mean I should simply adapt the ready.php to, right? $wire->addHookAfter('Pages::saveReady', function($event) { $event->modules->get('SearchEngine')->indexPages($page); $page = $event->arguments(0); $event->wire('log')->save('Page saved', "Page ID: $page->id / Page Name: $page->name / Page Parents: $page->parents"); }); Thank a lot!
  9. Thank you very much for your advice! I have indeed found a hook that was apparently to blame. I can't remember exactly why I added it and what it does ... $wire->addHookAfter('Pages::saveReady', function($event) { $event->modules->get('SearchEngine')->indexPages(); $page = $event->arguments(0); $event->wire('log')->save('Page saved', "Page ID: $page->id / Page Name: $page->name / Page Parents: $page->parents"); });
  10. I have a site with about 5000 subpages and have noticed that it now takes about 10 seconds to save a page. What could be the reason for this and how can I speed up the site?
  11. Thank you for your reply. It works for me as a superuser. But the editor gets a warning message that he does not have the right to move pages (below this particular parent page). What rights do I need to give him to make this work? I have already spent half an hour unsuccessfully clicking through all the templates and role settings ...
  12. I am a little confused. As far as I remember, on my older Processwire pages, I can only move pages within the parent page (i.e. change the positions of the siblings). Now I've noticed that I can (recently?) move them across the entire page tree. How can I limit the moving of pages? I didn't get any further by setting the user rights.
  13. Thank you! Is this an official solution or some kind of hack? I can't find an info in the documentation.
  14. Hello! How can I manually deactivate or uninstall a module that no longer works after updating processwire and php? Or is it enough to simply remove the folder from the sites/modules folder? Thanks!
  15. Sorry, a made an error in thinking. There is a directory in the root with this name containing an index.html file.
  16. I have noticed some strange behavior. If I have a file in the root of the page called e.g. mypage.inc, it is displayed when I call up the url "myurl.de/mypage". Is this a bug or a feature?
  17. I miss the toolbar in edit mode! Previously, after clicking on "edit", the toolbar was still visible and I could close the edit view again using the "browse" button. After saving the page, the edit view is not closed either. Processwire: 3.0.210 Admin-Bar: 2.9.1
  18. Is there a way to load thumbs from youtube when links from piped.video are inserted? The urls are very similar. If this url was inserted: https://piped.video/watch?v=lWXhL62PSdw this thumb should be loaded from youtube, for example: https://img.youtube.com/vi/lWXhL62PSdw/0.jpg
  19. It also took me a while to understand drupal. In a nutshell: A template is called content type and instead of pages there are nodes. These nodes can be transformed into a page structure via a navigation module. The templating is also somewhat difficult and the structures are predefined. The advantage is probabely that the editor can create many things in the backend himself (e.g. with the views module). However, it is anything but intuitive or easy to understand and learn.
  20. I have created 4 larger wesites with drupal 7 before I got to know processwire. The modules and the community are great with drupal. But in the end I found it extremely annoying and frustrating. It was no fun and the projects often ended up taking much longer than expected. I can't say how it is with the newer versions ... If you want to have clean code the templating is quite complex. It seemed to me that the Drupal way was rather to take the very complex code as it is output (with nested elements and classes) and then just customize or hide elements in CSS. The module "views" (perhaps the most popular in drupal) is quite complicated and in the end limited in its possibilities. What is complicated to click together in "views" can often be done in processwire with pages->find in one line! What I also found annoying was that, depending on the modules used, the backend no longer looked very uniform. This is much better in processwire. If I have to make adjustments to the websites today, it takes me a while to think my way back into the structure and understand which module creates which content in which place. I am really happy to have found processwire and will certainly not be using drupal for another website.
  21. Big thanks to all of you! I simply used the $page->delete() in a template file like this: // Find old pages $pages = $pages->find("template=mytemplate, parent=myparent, sort=date, limit=50000"); // Delete old pages foreach ($pages as $page){ $page->delete(); };
  22. Hi! How can i best delete older pages via the console or directly in the database. There are several thousand pages so it is not possible to do it manually. I would like to delete all pages before a certain date or those that are older than a year, for example. Thanks!
  23. Arrrg, my 12 months support time must have expired ? Do I have to buy the module completely new or can I upgrade it?
  24. Hi! I would like to output the datetime field in the email in a different format. unfortunately i can't set that in the field setting. The output format is: "2021-12-01 00:00" What i need is: "01.12.2021" ... and without the Time Is there a way to make this work? Version: 0.5.1
×
×
  • Create New...