As a user I want to be able to create a contact form, add multiple email fields and set up emails to be sent to any of those fields.

Comments

blueblot created an issue. See original summary.

scott_euser’s picture

Hi Kris,

Thanks for raising the issue. I will try to take a look as soon as I can.
If you are a coder and keen on looking into it yourself, it'll likely be here: http://cgit.drupalcode.org/contact_emails/tree/src/ContactEmailerService...

// Recipients.
if ($email->recipient_is_submitter) {
  $to = $this->contactMessage->getSenderMail();
}
else {
  $to = implode(', ', $email->recipients);
}

Which calls the Drupal Core Message getSenderMail method from here.

I assume you still have the default email field showing on your field? Perhaps wise I add a validation for that in case as I suppose it's possible to remove it with a form alter.

Thanks,
Scott

blueblot’s picture

Hi Scott

I created a new form from Core contact. In there I placed some extra fields. My mailfield is field_mail.
Perhaps this would help?

I'm no coder, otherwise I would be glad to help sort this out.

Kris

scott_euser’s picture

Assigned: Unassigned » scott_euser
Category: Bug report » Feature request

Hi Kris,

When you go to your form and go to manage form display, there should be a field 'Sender email': that is the one that comes from the module doesn't yet support using a different field other than the built-in sender email field, but it shouldn't be too hard to add. I'll try to add it over the next couple of days; instead if you can make sure you're using the built-in sender email field for now it should work.

Thanks,
Scott

blueblot’s picture

Hi Scott

thx, this works like you planned it. Super.

Can you take a look at the token support too? I tried to add some custom fields to the body from token support, but this doesn't work.
Maybe I should create a new issue for this?

Hope to help you.

thx.

Kris

scott_euser’s picture

Glad that helped! Yeah if you could open another issue with perhaps a screenshot from manage fields and the body field of your email that would help.

Thanks,
Scott

scott_euser’s picture

Title: Mail to The submitter of the form isn't sent » Ability to send a mail to a custom field on a contact form rather than just the sender field

As a user I want to be able to create a contact form, add multiple email fields and set up emails to be sent to any of those fields.

scott_euser’s picture

Issue summary: View changes
broon’s picture

Any progress on that? I would be interested in that function as well.

I would even like to go as far as providing a settings option to select the field from the Contact form containing the email. Or even going further, not only list email fields but reference fields as well.

That way, you could create a content type "team" which describes various team members. This CT has an email field containing the team member's email address. In a team contact form, you would add a field "team member" (reference to nodes of type team) where the user can select a team member (s)he wants to get in contact with (the selection could btw be automated with Prepopulate module).
In the Contact Email settings, you would define the "team member" field as recipient, so the contact message gets always send to the team member selected in the contact form.

scott_euser’s picture

Hi Paul,

Sorry I haven't gotten to it yet, there were a few more critical issues. I don't think I'll bring in via reference on my own but if you're willing to contribute it as a patch I'd be happy to review and merge it in. If you are willing, perhaps best to wait until I finish adding the basic feature of selection of any email form field and patch on top of that.

Thanks,
Scott

broon’s picture

I will. I already looked into the code but being fairly new to D8, I am not sure how to get all the available fields from the respective contact form in a proper way. If I had access to that, it shouldn't be to hard to get either the email field directly from the form submission or from a referenced entity.

scott_euser’s picture

Sounds good, I am almost there with it, made some good progress yesterday and have the upgrade path set up.

Thanks,
Scott

  • scott_euser committed e2c8881 on 8.x-1.x
    Issue #2826305: Ability to send a mail to a custom field on a contact...
scott_euser’s picture

Version: 8.x-1.0 » 8.x-1.5
Status: Active » Fixed

This is now implemented, you can now select from an email field (including a repeating email field) from 8.x-1.5 onwards.

Paul, I have added your feature request as a new issue: https://www.drupal.org/node/2833627

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.