Django: Setting the from address on an email
<p>I'd like for my users to be able to enter their <code>email-address</code> and <code>message</code> and then send the email with the 'from address' being their own email-address. Currently the <code>EMAIL_HOST</code> is set on our own domain and the emails arrives when it is sent with a "from address" equal to our <code>HOST_USER</code>, but not if it is anything else. Is this possible?</p>

<p>Our settings:  </p>

<pre><code>EMAIL_HOST = 'smtp02.hostnet.nl'  
EMAIL_PORT = 587  
EMAIL_USE_TLS = True  
EMAIL_HOST_USER = "xxx"  
EMAIL_HOST_PASSWORD = "xxx"  
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
</code></pre>

<p>If you allow your users to set the from addresss, you may find that your emails are blocked by anti-spam measures.</p>

<p>A better approach would be to use an email address you control as the from address, and set the <code>reply_to</code> header on your email. Then, when the recipients click 'reply', the reply will go to the user's from address.</p>

<pre><code>email = EmailMessage(
    'Hello',
    'Body goes here',
    'your-email-address@example.com',  # from address
    ['to1@example.com', 'to2@example.com'], # recipients
    reply_to=[user_from_address],  # reply to address set by your user
)
email.send()
</code></pre>

python django smtp