A question that has many specific answers depending on your mail server. They are the ones who set the rules, and each one is a little different. I will try to walk you through the General steps, but you will need to fill in the specific information that your email provider requires.
I am attaching an image that will help you visualize along with the steps. The image starts at Step 2. Warning, some of the specifics have changed in Yosemite vs some of the older operating systems ( I am using Yosemite ) My information is obfuscated to protect myself.
A. Mail App Open
1. Click on Menu Bar: Mail: Drag down to Preferences and let go.
B.1. Prefferences Dialog
2. select Accounts
3. Click on the Dropdown "Outgoing Mail Server SMTP" lis
B.2 Dropdown List
4. Select "Edit SMTP Server List..."
C. SMTP Info Pane Account info Tab
5. Select email account you are having an issue with
6. Description is optional, but helpful for most people Name it accordingly
7. Server name. Will probably be something like "smtp.servername.com" or mail.servername.com
8. Select on the "Advanced" Tab
D. SMTP Info Pane Advanced Tab
9. You need a Port Number. You can have the system Choose for you, as there are typical port numbers 25 for Non SSL and 465 for SSL are a couple of them (there are others) If your email server wants a non-typical port number uncheck the "Automatically detect..." (may be different on older OS's)
for example, my work email requires a 26, this is atypical.
10. Authentication. Many email services require it. Usually these days it is "Password" (Not shown) in this case, it is probably your email address and the account password. (but not necessarily) sometimes it is formed as accountName+serverName.com instead of accountName@serverName.com
Sorry for keeping this so General, however, not any other way to do it without your specific information. Which you do NOT want to offer on the open web any way, hence my information obfuscated in the attached image.
Best of Luck!
Ex Geek at the official Fruit Stand.