In trying to migrate Python Scripts from ArcGIS Desktop Python 2.7.x to ArcGIS Pro 3.x, we email staff if there is a failure on a routine. Below I am running a sync replica routine using ArcGIS Pro, deliberately breaking it on the file path to the database connection string so it will email a failure. Somewhere in migration, it does not like the email code that has been working for years now. Has anyone else had to upgrade email failures from 2.7.x to 3.x in Python? With using the correct file path, the routine was successful. We use Windows Task Scheduler to run Python routines.
I receive the error (server name omitted for security):

<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>management<SPAN class="punctuation token">.</SPAN>SynchronizeChanges<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"C:\Tech_Info\DB_CONX\SERVER\SERVER ParentDatabase user.sde"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ReplicaName"</SPAN><SPAN class="punctuation token">,</SPAN> r<SPAN class="string token">"C:\Tech_Info\DB_CONX\Server\SERVER ChildDatabase user.sde"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FROM_GEODATABASE1_TO_2"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"IN_FAVOR_OF_GDB1"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"BY_OBJECT"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"RECONCILE "</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">except</SPAN> Exception <SPAN class="keyword token">as</SPAN> e<SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"SynchronizeChanges_management ISGIS.ReplicaName Failed..."</SPAN> <SPAN class="operator token">+</SPAN><SPAN class="string token">'\n'</SPAN><SPAN class="punctuation token">)</SPAN>
txtFile<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"SynchronizeChanges_management ISGIS.ReplicaName Failed..."</SPAN> <SPAN class="operator token">+</SPAN><SPAN class="string token">'\n'</SPAN><SPAN class="punctuation token">)</SPAN>
txtFile<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>GetMessages<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">'\n'</SPAN><SPAN class="punctuation token">)</SPAN>
HOST <SPAN class="operator token">=</SPAN> <SPAN class="string token">"host.server.com"</SPAN>
SUBJECT <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Priority: CRITICAL Routine Failure"</SPAN>
TO <SPAN class="operator token">=</SPAN> <SPAN class="string token">"email@python.org"</SPAN>
FROM <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Routine Failure<failure@python.org>"</SPAN>
text <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Routine has failed. Please see log file for detailed information. \n Error Message: \n "</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>e<SPAN class="punctuation token">.</SPAN>msg<SPAN class="punctuation token">)</SPAN>
BODY <SPAN class="operator token">=</SPAN> string<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>
<SPAN class="string token">"From: %s"</SPAN> <SPAN class="operator token">%</SPAN> FROM<SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"To: %s"</SPAN> <SPAN class="operator token">%</SPAN> TO<SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"Subject: %s"</SPAN> <SPAN class="operator token">%</SPAN> SUBJECT<SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN>
text
<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"\r\n"</SPAN><SPAN class="punctuation token">)</SPAN>
server <SPAN class="operator token">=</SPAN> smtplib<SPAN class="punctuation token">.</SPAN>SMTP<SPAN class="punctuation token">(</SPAN>HOST<SPAN class="punctuation token">)</SPAN>
server<SPAN class="punctuation token">.</SPAN>sendmail<SPAN class="punctuation token">(</SPAN>FROM<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN>TO<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> BODY<SPAN class="punctuation token">)</SPAN>
server<SPAN class="punctuation token">.</SPAN>quit<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>