← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #697175]: passing string to shell using runscript

 

Question #697175 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/697175

RaiMan proposed the following answer:
using the string format option mentioned by Manfred

def start_user(from, to):
    print('sending mail to user')
    mail_sending = """
    powershell
    $EmailFrom = %s
    $EmailTo = %s
    $Subject ="Try done"
    $Body ="Content of body"
    $SMTPServer ="smtp.server"
    $SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer, 587)
    $SMTPClient.EnableSsl = $true
    $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("info@xxxxxxx","password");
    $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
    """
    returnCode = runScript(mail_sending % (from, to))

start_user("myMail@xxxxxxxxxx", "Tom@xxxxxxx")

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.