Answers.Body: <p>I am not sure if all this is possible in current version of CiviCRM</p>
  
  <pre><code>#1 - Yes, one can define and select From Address for sending emails.
  
  #2 - CiviCRM sends email using settings defined in Outbound Settings.
  
  #3 - There is no such way where one can specify outbound settings based on from address. But this is possible by creating extension that would create a settings page for each from address to save in civicrm_setting table and then have [hook][1] to alter the mailer setting before sending emails.
  </code></pre>
  
  <p>But i would still prefer you to wait for other people to provide solution.</p>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-28T16:18:57.883Z
Answers.LastActivityDate: 2018-01-28T16:18:57.883Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>If I understand you correctly you need to <em>determine routing of some outbound email based on the recipient</em>. This is not a core functionality of CiviCRM.</p>
  
  <h2>Outbound, by extension</h2>
  
  <p>CiviCRM allows extensions to implement hooks, and I think for your needs the appropriate hook would be <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailer/" rel="nofollow noreferrer"><code>hook_civicrm_alterMailer()</code></a>.</p>
  
  <blockquote>
    <p>This hook is called when CiviCRM prepares an email driver class to handle outbound message delivery.</p>
  </blockquote>
  
  <p>The documentation linked above for this hook gives example code to deliver emails to a logfile instead of via SMTP. Creating an extension which implements this hook and routes email to your CEP server when required would hopefully deliver the outcome you need. If open-sourced, this would be available to other organisations with the same requirements, which is a great outcome.</p>
  
  <h2>Outbound, in MTA</h2>
  
  <p>Some mail servers (<a href="https://en.wikipedia.org/wiki/Message_transfer_agent" rel="nofollow noreferrer">MTA</a>) allow you to customise routing based on destination. If you control your hosting environment, you might be able to instruct an MTA to route emails for some recipients to be delivered via one channel (SMTP to a specific CEP service, or add headers to CC/sign per requirements), and others via default SMTP routing. An MTA could query for the correct behaviour based on destination email against CiviCRM's HTTP API.</p>
  
  <h2>Inbound</h2>
  
  <p>If you need to handle this on the inbound channel (when your organisation receives email), it's possible to configure multiple mailboxes to check in CiviCRM. This is done at <strong>Administer > CiviMail > Mail accounts</strong> and has documentation in <a href="https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/#adding-an-incoming-email-account-for-processing-bounces-andor-email-to-activities" rel="nofollow noreferrer">CiviMail incoming mail setup</a> and <a href="https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/inbound/" rel="nofollow noreferrer">CiviCRM inbound mail documentation</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-29T20:58:15.637Z
Answers.Text: If the above information doesn't answer your question, maybe you can add more specific requirements or details to your question? Hopefully you can edit your question on StackExchange, but you may need a few extra points to add comments. Welcome to StackExchange and the CiviCRM community!
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-29T20:57:36.123Z
Answers.LastActivityDate: 2018-01-29T21:49:43.210Z
Answers.LastEditDate: 2018-01-29T21:49:43.210Z
Answers.UserDisplayName: Chris Burgess
Body: <p>We have an issue to solve to operate as well in our Country (Italy).</p>
  
  <p>Any organization in our Country must use Certified Email (<a href="https://en.wikipedia.org/wiki/Certified_email" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Certified_email</a>) to send fiscal and official requests to public organization.
  This create a config problem inside CiviCRM, which I try to explain: </p>
  
  <ol>
  <li>we must use more than one address to outbound email</li>
  <li>the normal address can send all, using the normal and easy configuration</li>
  <li>the Certified Email address must use IMAP and the specific server to send messages</li>
  <li>we didn't find a possibility to configure this difference</li>
  <li>there are more than these problems to manage inbound email.</li>
  </ol>
  
  <p>Any idea to solve it?
  TIA</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-29T07:52:05.587Z
Comments.Text: I'm unfamiliar with CEP. Are you looking for a solution to process *inbound* mail (when your organisation *receives* CEP email from someone), *outbound* mail (when your CiviCRM sends CEP email to another organisation), or *both* cases?
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-17T18:34:24.490Z
Comments.Text: The main problem is to SEND emails, because there are 2 different accounts and way to do it; one for the normal emails and the other for the CEP.
  Inbound email must be solved later, because CEP sends back many messages about delivery tracking, which could be not so useful.
Comments.UserDisplayName: Francesco Garganese
Tags: <civimail><configuration>
Title: Outbound email configuration. Different sending addresses with different servers
ThreadText: # Outbound email configuration. Different sending addresses with different servers
  
  (Asked by: username_0 on 2018-01-28)
  
  We have an issue to solve to operate as well in our Country (Italy).
  
  Any organization in our Country must use Certified Email (<https://en.wikipedia.org/wiki/Certified_email>) to send fiscal and official requests to public organization.
  This create a config problem inside CiviCRM, which I try to explain:
  
  1. we must use more than one address to outbound email
  2. the normal address can send all, using the normal and easy configuration
  3. the Certified Email address must use IMAP and the specific server to send messages
  4. we didn't find a possibility to configure this difference
  5. there are more than these problems to manage inbound email.
  
  Any idea to solve it?
  TIA
  
  **Tags:** civimail, configuration
  
  > **Comments:**
  > **username_1**: I'm unfamiliar with CEP. Are you looking for a solution to process *inbound* mail (when your organisation *receives* CEP email from someone), *outbound* mail (when your CiviCRM sends CEP email to another organisation), or *both* cases?  
  > **username_0**: The main problem is to SEND emails, because there are 2 different accounts and way to do it; one for the normal emails and the other for the CEP. Inbound email must be solved later, because CEP sends back many messages about delivery tracking, which could be not so useful.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-01-28. Score: 1
  
  I am not sure if all this is possible in current version of CiviCRM
  #1 - Yes, one can define and select From Address for sending emails.
  
  #2 - CiviCRM sends email using settings defined in Outbound Settings.
  
  #3 - There is no such way where one can specify outbound settings based on from address. But this is possible by creating extension that would create a settings page for each from address to save in civicrm_setting table and then have [hook][1] to alter the mailer setting before sending emails.
  
  But i would still prefer you to wait for other people to provide solution.
  HTH
  Pradeep
  
  
  ---
  
  ### Answer by username_1 on 2018-01-29. Score: 1
  
  If I understand you correctly you need to *determine routing of some outbound email based on the recipient*. This is not a core functionality of CiviCRM.
  
  ## Outbound, by extension
  
  CiviCRM allows extensions to implement hooks, and I think for your needs the appropriate hook would be [`hook_civicrm_alterMailer()`](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailer/).
  
  > This hook is called when CiviCRM prepares an email driver class to handle outbound message delivery.
  
  The documentation linked above for this hook gives example code to deliver emails to a logfile instead of via SMTP. Creating an extension which implements this hook and routes email to your CEP server when required would hopefully deliver the outcome you need. If open-sourced, this would be available to other organisations with the same requirements, which is a great outcome.
  
  ## Outbound, in MTA
  
  Some mail servers ([MTA](https://en.wikipedia.org/wiki/Message_transfer_agent)) allow you to customise routing based on destination. If you control your hosting environment, you might be able to instruct an MTA to route emails for some recipients to be delivered via one channel (SMTP to a specific CEP service, or add headers to CC/sign per requirements), and others via default SMTP routing. An MTA could query for the correct behaviour based on destination email against CiviCRM's HTTP API.
  
  ## Inbound
  
  If you need to handle this on the inbound channel (when your organisation receives email), it's possible to configure multiple mailboxes to check in CiviCRM. This is done at **Administer > CiviMail > Mail accounts** and has documentation in [CiviMail incoming mail setup](https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/#adding-an-incoming-email-account-for-processing-bounces-andor-email-to-activities) and [CiviCRM inbound mail documentation](https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/inbound/).
  
  > **Comments:**
  > **username_1**: If the above information doesn't answer your question, maybe you can add more specific requirements or details to your question? Hopefully you can edit your question on StackExchange, but you may need a few extra points to add comments. Welcome to StackExchange and the CiviCRM community!  
  
  ---
  
  