sendto = gp.GetParameterAsText(0).split(";") fromaddr = gp.GetParameterAsText(1) subject = gp.GetParameterAsText(2) text = gp.GetParameterAsText(3) zipfile = gp.GetParameterAsText(4).replace("\\",os.sep) maxsize = int(gp.GetParameterAsText(5)) * 1000000 smtpUser = gp.GetParameterAsText(6) smtpPwd = gp.GetParameterAsText(7) msg = MIMEMultipart('alternative') msg['From'] = fromaddr msg['To'] = COMMASPACE.join(sendto) msg['Date'] = formatdate(localtime=True) msg['Subject'] = subject html = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <body style="font-size:12px;font-family:Verdana"><p>Please download the attachment and then import into ArcMap to view.</p></body></html>""" #attach the zip file HTML_BODY = MIMEText(html, 'html') msg.attach( HTML_BODY) part = MIMEBase('application', "zip") # Change if different file type sent. part.set_payload( open(zipfile,"rb").read() ) email.encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(zipfile)) msg.attach(part) #Sending Mail server = SMTP('blah') server.set_debuglevel(1) server.login(smtpUser,smtpPwd) server.sendmail(fromaddr, sendto, msg.as_string()) server.quit()
Solved! Go to Solution.
Is there any idea for a work around? I would like to give this tool to another employee but I do not want to see there password if I need to modify the script in the future.
Hello,
The encrypted string parameter you're using is meant for tools which except an encrypted password (like our Create ArcSDE connection tool).
We've been having internal discussions about this particular type of parameter, something like a "hidden string", where in the UI you'd only see the ****, but the tool would get the actual string somewhere in the code and deal with it (in your example, authenticating an STMP server).
To answer your question, we dont have anything that will do what you want (hide the password in the UI), but the use case you outline below is helpful as we evaluate a new parameter type for a future release. Thank you.
Is there any idea for a work around? I would like to give this tool to another employee but I do not want to see there password if I need to modify the script in the future.