It's possible to generate content automatically from an email account. Gmail, Hotmail, and Yahoo email clients are all supported. To enable this dotCMS feature, use the following steps:
Note: Multiple relationships are not supported on the same Content Type when configuring import of emails as content. A Content Type can be configured only ONCE in the dotmarketing-config properties file.
- Create a Content Type in dotCMS that has the following fields (name them whatever you like):
- A Subject text field
- A To text field
- A From text field
- A Body WYSIWYG field to handle the body of the email
- A Binary Field to handle AttachmentOne
- A Binary Field to handle the AttachmentTwo
- If the emails will come in from only one email account move to step three, otherwise if the replies come in on a different email account, set up a secondary Content Type with similar fields as the first.
- Create a relationship - either a self-joining relationship where the child and parent Content Type are the same, or a one to many relationship between the two different parent and child Content Types.
- Configure the dotmarketing-config.properties file using the following examples:
Self Join configuration Example
The Content Type's properties need to be set using the pop.{ContentTypeVariableName}.property format. In the example below, the Content Type's variable name is ProfessionalSupport.##Content From Email Settings pop.ProfessionalSupport.host=pop.mail.yahoo.com pop.ProfessionalSupport.login={youraccounthere}@yahoo.com pop.ProfessionalSupport.password={yourpasswordhere} pop.ProfessionalSupport.port=995 pop.ProfessionalSupport.ssl=true ##Wiring the Content Type fields to email's fields pop.ProfessionalSupport.subject=title pop.ProfessionalSupport.messageId=messident pop.ProfessionalSupport.body=mainMessage pop.ProfessionalSupport.from=sender pop.ProfessionalSupport.to=recipient pop.ProfessionalSupport.attachment1=executable pop.ProfessionalSupport.attachment2=photo ##Note: Up to a maximum of 10 binary fields can be added to a Content Type using the same naming conventions illustrated above ##Relate Content pop.ProfessionalSupport.relationship.name=PProfessionalSupport-CProfessionalSupport pop.ProfessionalSupport.relationship.parent.messageId=messident
Two different Content Types with a One to Many Relationship
Both Content Type's properties need to be set using the pop.{ContentTypeVariableName&}.property format. In the example below, the parent Content Type's variable name is EnterpriseSupport and the child Content Type is named SupportReplies##Content From Email Settings pop.EnterpriseSupport.host=pop.gmail.com pop.EnterpriseSupport.login={youraccounthere}@gmail.com pop.EnterpriseSupport.password={yourpasswordhere} pop.EnterpriseSupport.port=995 pop.EnterpriseSupport.ssl=true ##Wiring the Content Type fields to email's fields pop.EnterpriseSupport.subject=title pop.EnterpriseSupport.messageId=messident pop.EnterpriseSupport.body=mainMessage pop.EnterpriseSupport.from=sender pop.EnterpriseSupport.to=recipient pop.EnterpriseSupport.attachment1=executable pop.EnterpriseSupport.attachment2=photo ##Content From Email Settings pop.SupportReplies.host=pop3.live.com pop.SupportReplies.login={youraccounthere}@hotmail.com pop.SupportReplies.password={yourpasswordhere} pop.SupportReplies.port=995 pop.SupportReplies.ssl=true ##Wiring the Content Type fields to email's fields pop.SupportReplies.subject=title pop.SupportReplies.body=mainMessage pop.SupportReplies.from=sender pop.SupportReplies.to=recipient pop.SupportReplies.attachment1=executable pop.SupportReplies.attachment2=photo ##Relate Content - use the child Content Type to define the relationship name and the parents keyfield pop.SupportReplies.relationship.name=EnterpriseSupport-SupportReplies pop.SupportReplies.relationship.parent.messageId=messident
Enable Content From Email and Set Up Email Synchronization
ENABLE_CREATE_CONTENT_FROM_EMAIL=true ## Content created from email every 10 minutes CONTENT_FROM_EMAIL_CRON_EXPRESSION=0 0/10 * * * ? CONTENT_FROM_EMAIL_INIT_DELAY=180
- Stop and redeploy the dotCMS instance
- After the time interval specified in the dotmarketing-config.properties file, the content should be created. Special Note: Yahoo and MSN mail servers will be directed to delete the emails from the inbox but Gmail servers do not allow this behavior. Duplicate content will not be created however, regardless of which of email account type is being used.
Note: Up to a maximum of 10 binary fields can be added to a "content from email" configured Content Type to handle email attachments.