Any suggestions on how to fix this?

Opera's a little quirky with detecting the internet connection in this case. No way to fix it. But, instead of restarting Opera, you should be able to goto "Menu -> settings" and check "work offline". Then, go back and uncheck it. After that, you might have to click the check/send button. Then it'll work again.

If this is with Gmail IMAP, make sure you have "included this account when checking manually" set. Also, make sure you have "Check for new messages every.." set between 9 and 31 minutes. Even then Opera and Gmail support IMAP IDLE, Opera still needs to check for new messages every now and then so IDLE doesn't time out. Also if using IMAP, make sure "low-bandwidth mode is off".