This project is read-only.

How to create a custom contact form

Feb 9, 2011 at 9:24 AM


   How to create a custom contact form that it has five text fields (name, email, designation, organization, website address), two drop downlist fields, comment textbox and submit button?

    I tried this way but it's out of my expectation:

    1) create new content type and then add those new fields onto this new content type. i called this new content type as Contact. The problem I face that there has not custom button where this button can save those fields data and send email to admin..

     2) Once created, trying to add new  list. the label of textfield showing combination... (no user friendly) Example: define: Your Email :    ( the system show it as YourEmail) Could show how to change this? Checking from database and storing only YourEmail.. Can't find Your Email : in database.

    Another problem I face is this contact form can't appear on CMS page for letting the users to fill in the data directly and click submit button. It's better to make it as widget and add it onto layer, but I can't figure it out on doing this...

Please advice.

Feb 9, 2011 at 7:06 PM

You should probably take a look at the existing contact modules that are already in the gallery.

The way I would do that is by creating a widget with a custom part with the properties you need. I'd build the details template of that part as a form with its own form tag. The action for that form tag should be a controller action that you write and where you persist the information yourself. Sending the e-mail through the messaging feature should be fairly easy, taking example on the user e-mail validation feature.

Feb 10, 2011 at 3:35 AM

Thanks for your instruction. I tried the existing contact form module and click send button. I check my mailbox and didn't receive any email from orchard.

Kindly see from the settings as below:  Do they got anything wrong setting?

i use gmail account as sender email address

Port Number: 465

Check 'Enable SSL Communication' and check 'Require Credential' 

Host Name:

User Name:

Password:   gmail password



Feb 10, 2011 at 4:22 AM


Try to debug this in VS (look in Intellitrace pane after pausing) and check if the mail get sent at all - if there are no Smtp-server related exceptions. This may be an issue with Gmail account (haven't tried it in Orchard, but had previously problems with connecting to Gmail from different apps).

Cheers, Piotr

Feb 10, 2011 at 6:12 AM

Try with port 587 please

Feb 10, 2011 at 6:35 AM
Edited Feb 10, 2011 at 6:38 AM

Hi pszmyd,

     I tried before to debug that sender email value is being set correctly. Anyway i check the mailbox that it's doesn't receive the email from orchard... strange...


    I tried port 587 before, can't work....


Feb 10, 2011 at 7:03 AM

You can also install SMTP4Dev which is a virtual smtp server for local development. It's available on codeplex, doesn't need to install anything. With it you can check if Orchard is the issue, or you account configuration. Though I am sure orchard is working because we have several production installation using email notifications.

Could you also check that your account can be used as a SMTP gateway ... this might be an option in Google Mail.

Feb 10, 2011 at 9:31 AM

Finally the port number problem. i set it as 25 and it's working.. i got receive email. anyway it's empty.. i found that there has one issue ticket is similar with my case..