I want to create an email form that will allow others to send and email to someone who has created a new custom post on our site.
This is the scenario:
A real estate site.
Someone posts their property and provides a contact email.
Someone else sees this listing and sends them an email - via a contact form.
In other words - passing an email from one form entry to another so that it becomes the “to” in the second form.
The screenshot represent a modal that pops up on a button click when someone wants to mail the poster of the property.
The mail that this modal form will send will be that of the property poster.
We can walk through this in some simple steps, however we first need to ensure that the Listing creator is adding their email to the listing even if it is not displaying publicly.
There must be an email to the listing poster.
The second step is to create a Post Type to hold the messages, you can call it Messages or Contact Mail.
On this you will need to add just an email field so the user can enter their email. The Name field can be the Post Title and the content area can be the default wordpress content area, unless you dont want to allow the user to have any formatting control. In this case you can just create a custom field where the user can type the message.
Also create a field called "Email To" this will hold the email of the person being contacted from the listing.
Once you have done this please let me know and we can move to building the form.
Just to clarify - this needs to be a new Custom Post Type that will take the email from this listing form hidden link (ie. the property poster) and "add" it as a "Email To" ?
How our forms work is that it is tied to a post type. So there would need to be a post type created to store the messages. This will essentially function as a message log for the contact form, while using the notification settings to send the emails.
However for this to send to the correct user the "email to" custom field will need to be populated with the email of the Job listing.
We are able to get this from the page when the message form is added to the job listing.
Please let me know if this clears things up for you.
Great, following on from your reply (#1360613), I've created a new post type called 'Stored_contacts' and using Toolset's Custom fields, I created 4 fields: Name, Email, Message and Email to (see screenshot). Is this correct?
If so, what is the next step?
I can provide access to the admin section of the site if this makes it easier.
1 - how do I hide the form from showing on the bottom of the page. I'm hesitant to delete it from the bottom of the "Template layout for Rental pages".
2 - how do I hide the "to" email in the modal? I don't want the sender to see the recipient's mail.