One of the tools available to test database mail is to take SQL out of the equation and test directly using Telnet.
The first step is to try to Telnet, using the right port.
These commands are run from the CMD prompt on the host where you want to send emails from, and since it's old technology, you cannot make typos. The delete key most of the time does not work so you will have to start over.
Let's say the SMTP server is mail.domain.ext and you are sending emails from a "dummy" account called "firstname.lastname@example.org" to your own account "email@example.com"
telnet mail.domain.ext 25
If we are not able to even Telnet to the SMTP server, there might be Network or Firewall issues. Otherwise it should open a new window, and a black prompt
Trying 10.152.152.152... Connected to mail.domain.ext. Escape character is '^]'. 220 mail.domain.ext ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?
Then start your commands:
HELO Mail.com 250 mail.domain.ext Hello local.domain.name [loc.al.i.p], pleased to meet you
Don't worry too much about your local domain name although you really should use your exact fully qualified domain name as seen by the outside world the mail server has no choice but to take your word for it as of RFC822-RFC1123. This should give you:
250 mail.domain.ext Hello local.domain.name [loc.al.i.p], pleased to meet you
Enter your email info:
MAIL FROM: firstname.lastname@example.org 250 2.1.0 email@example.com... Sender ok RCPT TO: firstname.lastname@example.org 250 2.1.0 email@example.com... Recipient ok DATA Type in something here .
To end the message enter a single "." on a line on it's own.
The mail server should reply with: 250 2.0.0 ???????? Message accepted for delivery.
If we are able to Telnet, but we are not allowed to send emails ("unable to relay message"), it means that we are talking to the SMTP server, but we are not part of the Account Control List (ACL) on the SMTP server. Ask the Admin to add you to the ACL so we can relay emails to your own network (provide the part after the @ sign of your email).
You can close the connection by issuing the QUIT command. The mailserver should reply with something like:
221 2.0.0 mail.domain.ext closing connection Connection closed by foreign host.