Closed (fixed)
Project:
Mime Mail
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 May 2010 at 07:01 UTC
Updated:
19 Jun 2011 at 10:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
claudiu.cristeaWith this patch we can use mimemail() for sending or only for preparing like drupal_mail() - see http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/6.
A new argument $send was appended and 2 wrapper functions were added: mimemail_prepare() & mimemail_send().
Wanna prepare the message but not send it? For example we want to spool and not send it.
or
Wanna send an already prepared message? Example: Send prepared messages from a spool queue
Comment #2
claudiu.cristeaAlso reordered functions inside module because they were somehow mixed.
Comment #3
sgabe commentedYou can't add a new function named mimemail_prepare() because Drupal core has a hook_prepare(). Please, don't create new functions. Just add a $send parameter to mimemail() and if it's TRUE then return the $message as it is.
Comment #4
claudiu.cristea@sgabe,
Good catch! But a "send" wrapper must be added as drupal_mail_send() is for drupal_mail(). If we don't have the second function we cannot send directly a "prepared" messages.
I've integrated Mimemail in Views Send module. Messages are spooled and the module philosophy is to alter/prepare/render everything when adding messages to the queue. On cron the queue is processed and I need only the send part which needs a API function.
Should we leave it as
mimemail_send()or rename it asmimemail_mail_send()(for similarity reasons)?Comment #5
claudiu.cristeaHere's a patch based on #3 and #4.
Switched to classical patch format as is easiest to read and don't want my e-mail listed.
Comment #6
sgabe commentedWell, I would say let's name it
mimemail_send_message()and clean things up a little bit. Note that this API change needs to be done in alpha stage and we are very close to move towards a stable release.Comment #7
claudiu.cristeaNote that now
mimemail()really returns the whole$messagearray as it was already state (but not effective) in phpdoc:This is an API change and modules using
mimemail()must adapt.Comment #8
sgabe commentedYeah, I was thinking about to change that behavior to return a bool value when the message is sent directly, but in the other hand I think it would be better to stick with the Drupal core behavior and return the whole message with the result. However, we missed to update the README.txt with this change.
Comment #9
claudiu.cristeaAdded also the README.txt and deleted a trailing space somewhere in the last patch.
Comment #10
sgabe commentedThanks, looks good. Now I am thinking about how to handle this major API change. Maybe we should provide patches to the most used modules - like Simplenews and Webform - before committing, so we can make this change as smooth as possible.
Comment #11
claudiu.cristeaCreated a patch for Webform 6.x-3.x-dev here http://drupal.org/node/1087598. I'm not using Simplenews so I cannot test/patch.
Comment #12
sgabe commentedPatches attached for Simplenews in #1112310: Mime Mail returns array instead of bool.
Comment #13
sgabe commentedCommitted to the development snapshot. Thanks!
Comment #15
sgabe commentedA minor follow-up to this.
Comment #16
roball commentedSo, just to ensure - when upgrading Mime Mail to 6.x-1.0-beta1, Webform has to be >= 6.x-3.11 and Simplenews >= 6.x-2.0-alpha2, right? What about Views send?
Comment #17
sgabe commentedSince claudiu.cristea is the maintainer of Views Send and he suggested this change it is already supported by Views Send.
Comment #18
roball commentedThank you for making that clear.