I'm not entirely certain of all definitions, so some info may not be 100% accurate, and please take this into account when reading (google things to become certain, or wait for answers from someone more knowledgeable).
I believe relaying is passing emails from server local to non-local or non-local to local. Moreover, you most likely have to send email from an existing and known address.
So, your SMTP server should be on the same network as the origin of the SMTP connection. Do note that it would be possible to SSH or telnet to the SMTP server, and from that server connect to the SMTP server at localhost:25 or :587.
And the from address (or perhaps it's enough with a valid reply-to address) should exist and belong to the same domain as the SMTP server. That is, if the SMTP server is smtp.example.com, the sending address has to be some.existing.address@example.com.
The specific rules that do apply may change depending on configuration and server though, so either go by trial and error or read docs and check the config.