I want to be able to send emails with drupal 8 using postfix. The latter is configured to use a relay server.
For example, I'm using the module webforms, so I could test the sending of emails

All that I have done

sudo apt install postfix

During the installation I selected

  • Internet Site
  • System mail name: gonzalonazareno.org

Inside /etc/postfix/main.cf I changed

myhostname = drupal.gonzalonazareno.org
relayhost = babuino-smtp.gonzalonazareno.org

After this I restarted postfix, and tested postfix with this

echo "body of your email" | mail -s "This is a Subject" -a "From: [email protected]" [email protected]

But when I send an email I get nothing

Important notes

  • Some information here may not have sense, because I'm pretty lost with this task. All I know, is that I need to send an email, using postfix, and that relay server. Postfix will send the email to the relay, but after that, I don't really know if that email stores the messages...etc. Also, I don't know how to make drupal send that email, I can't figure out how can it do it.
  • I think that you can test the smtp server I need to use babuino-smtp.gonzalonazareno.org, and check if maybe it's having problems

Post Data

My apologies if this question is confusing, but my understanding of email servers if pretty basic + I'm really lost

1 Answer 1



I had 2 main problems

  • The SMTP server I was usingbabuino-smtp.gonzalonazareno.org was only accessible via the intranet of our highschool, so postfix couldn't communicate with it
  • After all the postfix configuration, I was trying to test if it worked with the following command
echo "body of your email" | mail -s "This is a Subject" -a "From: [email protected]" [email protected]

Which was wrong, because I figured out that you cannot send an email to a non-existing address [email protected] (maybe you can, but then how could you check the email?)

After all, when I came to class today and I was connected to the intranet, email sending was working. The command above worked, and also drupal could send an email (using the contact module for forms). I did both tests with my gmail account of course

Now, I would really appreciate if someone that knows how all this stuff works could complete the information about how drupal knows how to communicate with postfix. Because yep, it worked for me, but I just configured drupal to use a smtp server, and to send forms to a @gmail.com recipient.
I configured literally nothing for something like "making drupal choose what to use for sending emails"
Does this come pre-configured with drupal? I would like to know it if possible

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .