It looks like you’re using two different mail servers, assuming that Mail.app is successfully logging into a mail server.
If you can send mail from your Mac, and have an external mail account somewhere, like Gmail, send yourself a message. And do the same from Webmail.
Now start looking at the Full Headers of your messages:
• In that Gmail account for both received messages
• In Mail.app for the last message you received
• In Webmail for the last message you received
Buried in the headers will be the actual mail server. Read through some of the Recieved By hosts for any differences.