Jump to content

horst

PW-Moderators
  • Posts

    4,064
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. Hhm, sorry! With the 0.0.5 I have added a configuration option that lets you choose when an optional MailSignature should be send, but have left a boolean true somewhere in the code that overrides always these setting. Have corrected this now and committed the v 0.0.6 to GitHub. (ZIP)
  2. I have updated the class to version 0.0.5 and also have edited the first post of this thread (added some short examples and a list of available options/methods). Now per default the module sends multiple messages in a loop, (one for each TO-recipient) like the base class do. Additionaly you can call sendBulk to send larger amount of messages at once in an optimized manner, - or you can call sendSingle to set the module to allow only one TO-recipient but additionally CC-recipients. More information are now in the first post here.
  3. Thanks for the coffee and the well formed and corrected code!
  4. Yes, same with me! As a sitenote, if you like a post here in the forums (any post, not only that in your threads) you can show that by clicking the [like this] button. This is a forums internal system, not fac*bo*k. There is no harm to use it (I remember that I first realized this after 4 weeks posting and reading here)
  5. @teppo: I think logging is mandatory, even if you throw an exception. Also doing an automated fallback from SMTP to php-mail, without the users knowing isn't good in my opinion. Per default I would raise an error (and log it), but would give a configuration setting under advanced (or something) where the user have the possibility to enable that useful behave. If he check that option, _he_ has done so and not _you_, means he has at least be informed about that behave one times. I'm a big fan of (automated) corrections for the user with missconfigurations, but with emails are a million possibilities given. Maybe on a company site they must use SMTP through a special company server to send company-internal messages, it could be that there are very restrictive settings and a mail from php-mail gets blocked and never reaching the recipients. (Sure, a rare case, but may be possible).
  6. Hi Bbeer, you can try the sharpening option values: $options = array( 'cropping' => 'center', 'sharpening' => 'medium' // none | soft | medium | strong ); You may also check your default setting in the site/config.php file: $config->imageSizerOptions = array( 'upscaling' => true, // upscale if necessary to reach target size? 'cropping' => true, // crop if necessary to reach target size? 'autoRotation' => true, // automatically correct orientation? 'sharpening' => 'soft', // sharpening: none | soft | medium | strong 'quality' => 90, // quality: 1-100 where higher is better but bigger ); EDIT: if you want to test out different settings, remember to use $thumb->removeVariations() before creating the new thumb.
  7. Hi Zahari, $yourRegularLimit = 10; $cur = $input->pageNum; $max = intval($pages->find("$yourSelector, limit=2")->getTotal() / $yourRegularLimit); // limit = 2 so it is fast and uses less memory! $next = $cur<$max ? $cur + 1 : false; $prev = $cur>1 ? $cur - 1 : false; echo '<link rel="canonical" href="http://site.com/parent/page' . $cur . '/" />'; if(false!==$prev) echo '<link rel="prev" href="http://site.com/parent/page' . $prev . '/" />'; if(false!==$next) echo '<link rel="next" href="http://site.com/parent/page' . $next . '/" />'; Not tested, just to ge you started,
  8. This sounds a bit shizophren to me: clients want to have a powerful and great website but are not willing to pay 10$ per month for a good working shared host? This is similar to people that buy a big windows machine for 2.000+ with viodeoadapter(s) that cost 500 per unit. Buy games that cost (I don't know) but want to save 29,95 for a commercial Antivirus-App. --- And also with this sluggish shared hosts you will run into other serious problems like not enough memory for php (when it comes to image manipulation), very restrictive settings or using a not well configured apache with php as fastcgi (wath is in fact the opposite of fast), etc. etc. It doesn't depend on the DB alone, so what will be next that would be great to build into PW to _help_ the clients save 5$ per month?
  9. what (default) settings have you used for upscaling and cropping when called $img->size(200,100) ? (ich frage hier auch noch mal nach falls Du die Email nicht siehst. skype nutze / habe ich nicht) EDIT 1: I got the mail EDIT 2: issue seems to be solved! (PR will follow)
  10. You can traverse the "parent" property of the found page of type category | subcategory | file until you find a page that has a template file. Here is some pseudo code: while($page->template->filename == "") { $page = $page->parent; } I haven't tested this and I'm not sure if this is working. It is meant as starting point.
  11. You may send a PullRequest on Github ( https://github.com/apeisa/Thumbnails )
  12. Yes have read it in SwiftMailer-Thread before. I will update the module after posting this. Also have allready downloaded a fresh wire folder from Github. Lazyness! If using the object->style (not the procedural function call), there is no need to specify it when a default sender is set in config settings. But it could be overwritten by the $mail->from. Maybe I should make it an optional setting, not a required one. I have thought of a setting that prevents overwriting settings from the config screen. Default Sender is the only one valid. Recipients could be a whitelist (currently a textarea under tab advanced) and a checkbox to include emailaddresses from PW users or not. If a security restriction like this is implemented and checked, mails only get send to recipients from the valid_recipients list. Is this a useful feature? This is used when connecting to the SMTP-Server. You find it as the first entry in the Received header of every received mail. For example my local test account is called pw4.kawobi.local, this is what the headers look: Return-Path: <xxxx@xxxxxxx.xx> X-Original-To: xxxx@xxxxxxx.xx Received: from pw4.kawobi.local (dslb-084-099-066-105.t-online [84.99.66.105]) by xyz1234.smtpserver.com (Postfix) with ESMTPSA id 5EDBC2C004E6 for <xxxx@xxxxxxx.xx>; Mon, 3 Mar 2014 19:00:10 +0100 (CET) To: Peter Mueller <xxxx@xxxxxxx.xx> Subject: WireMailSmtp Test MultipartAlternative As far as I know, this is common usage, but with most clients you cannot influence the chosen name. EDIT: Module is updated to v0.0.4, look into the first post please.
  13. Ryan, this is awesome! Many thanks for this magical email handling
  14. Hi hajo, per default new pages have a status unpublished. You can edit them multiple times and still save them as unpublished. You should have a [ save + keep unpublished ] button two times (top and bottom) when first editing a page and a [ publish ] button only one time at the bottom. If this is not enough for your needs, I think you have to create a few lines of code that hook into an event when a new page is created and do this setting there.
  15. it depends on what you want to do with the installation in new.mydomain.com If you drop them after successfully copied over, there is no need for transferring the DB. If you want keep the new.mydomain.com for future testings, you should not use the same DB for both. Then you should copy your DB and modify your test-domain to use that insteed. Just my thoughts,
  16. Wire Mail SMTP An extension to the (new) WireMail base class that uses SMTP-transport This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times. The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only). Here are Ryans announcement. Current Version 0.6.0 Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md get it from the Modules Directory Install and Configure Download the module into your site/modules/ directory and install it. In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature. You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts. Usage Examples The simplest way to use it: $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient. You may also use the object oriented style: $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire: $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients. $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array: $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working: $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; } A MORE ADVANCED DEBUG METHOD! You can add some debug code into a template file and call a page with it: $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage. The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one: Following are a ... List of all options and features testConnection () - returns true on success, false on failures sendSingle ( true | false ) - default is false sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+) to ($recipients) - one emailaddress or array with multiple emailaddresses cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses bcc ($recipients) - one emailaddress or array with multiple emailaddresses from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest dispositionNotification () or notification () - request a Disposition Notification subject ($subject) - subject of the message body ($textBody) - use this one alone to create and send plainText emailmessages bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback) addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here (only available if a signature is defined in the config screen) attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename send () - send the message(s) and return number of successful sent messages debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!) getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses, logActivity ($logmessage) - you may log success if you want logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here sentLogReset () - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter sentLogGet () - is called automaticly within the send() method - returns an array containing all previously used emailaddresses sentLogAdd ($emailaddress) - is called automaticly within the send() method Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
  17. Ryan, I would like to have the possibility not to use only the Emailaddress but also the Recipients Names with the TO-array. Actually it accepts only a single emailaddress or an array with emailaddresses, but no names. When building that on my own I would have to break compatibility. Don't like that. Could we not use something like: public function to($email) { if(!is_array($email)) $email = explode(',', $email); $this->mail['to'] = array(); // clear // check for key-value pairs containing name=>email if(array_keys($email) !== range(0, count($email) - 1)) { foreach($email as $n=>$e) { $this->mail['to'][$n] = $this->sanitizeEmail($e); } } else { foreach($email as $e) { $this->mail['to'][] = $this->sanitizeEmail($e); } } return $this; } // also within the send() function we have to check if we have array with name=>email or string only with email I'm not happy with my code example. A better way is much appreciated, but I really would like to have that possibility. ---------------------------------------------------------- - EDIT ---------------------------------------------------------- Now after some testing I came up with this code what seems to be better: public function to($email) { if(!is_array($email)) $email = explode(',', $email); $this->mail['to'] = array(); // clear foreach($email as $n=>$e) { // check for associative key-value pairs containing name=>email if(is_string($n)) { $this->mail[$type][$this->sanitizeHeader($n)] = $this->sanitizeEmail($e); } else { $this->mail['to'][] = $this->sanitizeEmail($e); } } return $this; } And in the send() function we need to loop like this: $numSent = 0; foreach($this->to as $n=>$to) { $to = !is_string($n) ? $to : ( $n . ' <' . $to . '>' ); if(mail($to, $this->subject, $body, $header, $param)) $numSent++; }
  18. I don't have a static IP and I use a special string within the UserAgent, for example: RewriteCond %{HTTP_USER_AGENT} !^.*(b346a0b6fe9d440d68e07c9619c0ba0a).*$ This way (with switching UserAgent of the browser) I am able to look to the site as admin and like the public from the same IP.
  19. Yes it is working well. I have a site on a shared host where I have got sometimes this "2006 Server has gone away" error, especially when the client was working in the admin with large pagelists (he wants to have the default limit of 50 increased to 200). But this wasn't the only time when this happens. Now after update it with your patch I think we have to wait a week or two to be really sure it is solved. But actually I think yes it will be!
  20. Many thanks. Have installed it.
  21. Ok, give me a few from your accounts around the web.
  22. That's correct, it's not the best but the badest solution! http://plaintextoffenders.com/
  23. Oh good you have some progress! Have you different PHP-Versions for local and online? Password recovery or reset
  24. Sorry, I cannot really follow what you have done There are good explanation in the API with the Hello World module and many related posts here in the forums. If you want to search for something you should not use the forums search. Instead you should use google with queries like: site:processwire.com/talk write my own module (the 'site:processwire.com' part is important). If you only want to search in the forums you add a /talk to the domain, etc. You also may ask Felix what he want do with hybridAuth and if he plan / is able to share his work.
  25. what page do you try to access? where is it (url)? which part generate the error? do you have additional code for pw running not only the include? if yes, comment it out - you need to go step by step for trouble shooting. BTW: I have edited my post above, I think bootstrapping isn't the way you have to go here.
×
×
  • Create New...