Is it possible to define two smtp server in mail configuration?

hi, i had a question regarding define two server in mail configuration. if i send a message from gmail to server that i already define in the configuration, it work well. but i was wondering what if the user have gmail/ yahoo and send a message to another user who used gmail/yahoo? is there any changes that i should do? Thank you for your attention.

; Email Settings ;


; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
smtp_server =
smtp_port = 25

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
; smtp_auth = ssl
; smtp_username = username
; smtp_password = password