How can I add create a multi-part email in D7? I need to add custom part to an email.

I am trying to use hook_mail_alter to append a new content type. The content type is Content-Type: text/calendar. I can't figure out where to add it in the $message array.

I have tried mimemail but it seems to disregard my SMTP settings.

  • 1
    What do you mean by adding part to emails? Which email? User confirmation email, lost password email etc?
    – herci
    Commented Aug 7, 2015 at 17:18
  • I do agree with @herci , without enough information provided in question , its impossible to answer . Commented Aug 7, 2015 at 17:43

1 Answer 1


You could use hook_mail_alter to alter the email message before sending it out. you could change or alter the email body, sender, attachments....etc as you wish

  • Yes that is what I am trying to do. hook_mail_alter gives me access to the message array. But I don't see how I can add another content type to the message. Commented Aug 7, 2015 at 18:47
  • What you mean "add another content type to the message."?
    – sam2de
    Commented Aug 7, 2015 at 18:49
  • Emails are composed of different content types: Content-Type: text/plain, Content-Type: text/html, etc. I need add another content type of Content-Type: text/calendar; Commented Aug 7, 2015 at 18:53
  • I see, it's a bit confusing becase I thought you are refering to "Drupal content types". anyway according to the API you can change that in the "$headers" param
    – sam2de
    Commented Aug 7, 2015 at 19:07
  • Any examples anywhere? Commented Aug 7, 2015 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.