I'd like to send my mails as a mimemail / HTML mail.

Please share it if you know how to do it.

Thanks

Comments

bsandor’s picture

Title: How to send a mimemail? » How to send a mimemail / HTML mail with this module?
Issue summary: View changes
bsandor’s picture

I started like this which did not work:

function custom_message_entity_insert($entity, $type) {
                $message_type = 'created_project';
                $message_values = array();
                $message_values['uid'] = $entity->uid;
                $message_values['headers']['Content-Type'] = 'text/html; charset=UTF-8;';
                $message = message_create($message_type, $message_values);
                
                $wrapper = entity_metadata_wrapper('message', $message);
                $wrapper->field_mtype_crproject_node_ref->set($entity);
                $wrapper->field_mtype_crproject_published->set($entity->status);
                $wrapper->save();
                
                $subscribe_options = array();
                $subscribe_options['save message'] = TRUE;
                $subscribe_options['use queue'] = TRUE;
                message_subscribe_send_message('node', $entity, $message, array(), $subscribe_options);
}
nelsonre’s picture

I used this module in combination with the message_notify (https://www.drupal.org/project/message_notify) and htmlmail (https://www.drupal.org/project/htmlmail) module.

ggive’s picture

@nelsonre

Can u please share how you've set htmlmail.
I'm using message_notify & htmlmail as well, emails are sent and received with themed template (htmlmail.tpl.php) but there no content.

thanks

nelsonre’s picture

@ggive
Hmmm, without actually seeing your set up it's hard to diagnose.
Does it work without htmlmail for you?
I'm just trying to figure out why there would be no content. If you don't get content even without htmlmail, you might want to make sure are using message_notify properly.

As for htmlmail, did you set htmlmail here: admin/config/system/mailsystem ? You can either set up it as the system-wide default or just for the "message notify" class

Failing that, you might want to trace the code and put a breakpoint in the htmlmai.tpl.php to see if you are actually going in there.

ggive’s picture

@nelsonre Thanks for your post.

I did theme my htmlmail template and Account activation, Password recovery... email are working just fine.
I'm using drupal commons profil, which use message_notify to notifiy users by mail when they post and htmlmail.tpl.php is being used as I can see theming is apply but email content is missing.
For now I'm just setting up it as the system-wide default. I've even tried proposed template "htmlmail--message_notify.tpl.php" still get same results.
I guess i'm missing something in order to make it show content.

Thanks in advance

My settings

MailSystem settings

In admin/config/system/mailsystem

  1. Site-wide default MailSystemInterface > HTMLMailSystem
  2. HTML Mail module class > HTMLMailSystem
  3. Theme to render the meails > MyCustomTheme (based on zen)

HTMLmail settings

  1. Step 1 : I did copy htmlmail.tpl.php in my MyTheme/templates/
  2. Step 2 : Email theme : MyTheme
  3. Step 3 : Post-filtering : HTML email

Bellow debug output


To customize this message:
Copy
sites/all/modules/contrib/htmlmail/htmlmail.tpl.php
to
sites/all/themes/moncoach/htmlmail.tpl.php

For module-specific customization, copy
sites/all/modules/contrib/htmlmail/htmlmail.tpl.php
to
sites/all/themes/moncoach/htmlmail--message_notify.tpl.php
For message-specific customization, copy
sites/all/modules/contrib/htmlmail/htmlmail.tpl.php
to
sites/all/themes/moncoach/htmlmail--message_notify--og_new_content.tpl.php

Edit the copied file.
Send a test message to make sure your customizations worked.
If you think your customizations would be of use to others,
please contribute your file as a feature request in the
issue queue.

The message_notify module sets the $params
variable. For this message,

$params = Array
(
    [message_notify_email_subject] => 
    [message_notify_email_body] => 
    [message_entity] => Message Object
        (
            [type] => og_new_content
            [timestamp] => 1428055577
            [arguments] => Array
                (
                )
            [data] => Array
                (
                )
            [entityType:protected] => message
            [entityInfo:protected] => Array
                (
                    [label] => Message
                    [controller class] => EntityAPIController
                    [entity class] => Message
                    [base table] => message
                    [fieldable] => 1
                    [access callback] => message_access
                    [entity keys] => Array
                        (
                            [id] => mid
                            [label] => 
                            [bundle] => type
                            [language] => language
                            [revision] => 
                        )
                    [bundles] => Array
                        (
                            [commons_activity_streams_comment_created] => Array
                                (
                                    [label] => commons_activity_streams_comment_created
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_activity_streams_comment_created
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_activity_streams_node_created] => Array
                                (
                                    [label] => commons_activity_streams_node_created
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_activity_streams_node_created
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_activity_streams_user_profile_updated] => Array
                                (
                                    [label] => commons_activity_streams_user_profile_updated
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_activity_streams_user_profile_updated
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_follow_user_user_followed] => Array
                                (
                                    [label] => commons_follow_user_user_followed
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_follow_user_user_followed
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_like_user_likes_node] => Array
                                (
                                    [label] => Commons like: User likes a node
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_like_user_likes_node
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_notify_comment_created] => Array
                                (
                                    [label] => Commons Notify: Comment created
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_notify_comment_created
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_notify_comment_created_no_groups] => Array
                                (
                                    [label] => Commons Notify: Comment created no groups
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_notify_comment_created_no_groups
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_notify_node_created] => Array
                                (
                                    [label] => The notification sent when a user creates a node.
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_notify_node_created
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_notify_node_created_no_groups] => Array
                                (
                                    [label] => The notification sent when a user creates a node that is not in any groups
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_notify_node_created_no_groups
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [commons_posts_post_created] => Array
                                (
                                    [label] => Commons Posts - Post Created
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/commons_posts_post_created
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [trusted_contact_request_approved] => Array
                                (
                                    [label] => Trusted-Contact request approved
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/trusted_contact_request_approved
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [trusted_contact_request_pending] => Array
                                (
                                    [label] => Trusted-Contact request pending
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/trusted_contact_request_pending
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                            [og_new_content] => Array
                                (
                                    [label] => OG new content
                                    [admin] => Array
                                        (
                                            [path] => admin/structure/messages/manage/%message_type
                                            [real path] => admin/structure/messages/manage/og_new_content
                                            [bundle argument] => 4
                                            [access arguments] => Array
                                                (
                                                    [0] => administer message types
                                                )
                                        )
                                    [rdf_mapping] => Array
                                        (
                                        )
                                )
                        )
                    [bundle keys] => Array
                        (
                            [bundle] => name
                        )
                    [view modes] => Array
                        (
                            [full] => Array
                                (
                                    [label] => Full
                                    [custom settings] => 
                                )
                            [diff_standard] => Array
                                (
                                    [label] => Revision comparison
                                    [custom settings] => 
                                )
                            [message_notify_email_subject] => Array
                                (
                                    [label] => Notify - Email subject
                                    [custom settings] => 1
                                )
                            [message_notify_email_body] => Array
                                (
                                    [label] => Notify - Email body
                                    [custom settings] => 1
                                )
                            [token] => Array
                                (
                                    [label] => Tokens
                                    [custom settings] => 
                                )
                        )
                    [module] => message
                    [metadata controller class] => MessageMetadataController
                    [views controller class] => MessageViewsController
                    [entity cache] => 1
                    [static cache] => 1
                    [field cache] => 
                    [load hook] => message_load
                    [translation] => Array
                        (
                        )
                    [schema_fields_sql] => Array
                        (
                            [base table] => Array
                                (
                                    [0] => mid
                                    [1] => type
                                    [2] => arguments
                                    [3] => uid
                                    [4] => timestamp
                                    [5] => language
                                )
                        )
                    [token type] => message
                    [apachesolr] => Array
                        (
                            [indexable] => 
                            [status callback] => 
                            [document callback] => 
                            [reindex callback] => 
                            [bundles changed callback] => 
                        )
                    [configuration] => 
                )
            [idKey:protected] => mid
            [nameKey:protected] => mid
            [statusKey:protected] => status
            [defaultLabel:protected] => 
            [wrapper:protected] => 
            [uid] => 1
            [field_node_reference] => Array
                (
                    [und] => Array
                        (
                            [0] => Array
                                (
                                    [target_id] => 775
                                )
                        )
                )
            [mid] => 2795
            [language] => 
        )
)
bluegeek9’s picture

Status: Active » Closed (outdated)