I am trying to send an email, using the invoke code activity, and it is working fine.
But i need to define a variable for the target email ,as seen below line:
But if i write anything apart from the email, it throws a error for exception in code.
So, any one has experience on how to call the target email, as a input variable from a end user?
Full invoke code sample:
Dim smtpClient As New System.Net.Mail.SmtpClient(in_MailServer)
Dim mailMsg As New System.Net.Mail.MailMessage
Dim sender As New System.Net.Mail.MailAddress(in_Sender)
mailMsg.To.Add(in_MailTo)
mailmsg.Body = in_MailMsgBody
mailMsg.Subject = in_Subject
mailMsg.From = sender
mailMsg.IsBodyHtml = True
smtpClient.Port = Integer.Parse(in_MailPort)
smtpClient.Send(mailMsg)
I am not answering your question fully, but to easy your automation you could use the “Send SMTP Mail Message” activity, which contains the relevant input for the SMTP mail:
I can use, input dialog to take the email address as input, as an example the email is XXX@gmail.com and assign it to a variable called “email”. Now i want to call this variable in the invoke code sample attached above? how to do that?
I can use, input dialog to take the email address as input, as an example the email is XXX@gmail.com and assign it to a variable called “email”. Now i want to call this variable in the invoke code sample attached above? how to do that?
Thanks Martin, but i am using invoke code, as i do not have a username password, so invoke code is an alternative, and it works fine in my case. But i need to call a variable, which should be target email in the code, which i am trying to figure out how?
Just to clarify the use of the SMTP Activity. The SMTP “Username/Password” is optional if your SMTP server does not require it.
I respect if you want to use the Invoke Code, but the Activity is quite effective.
i am try to implement the similar functionality.
i am new to uipath. i am trying to send email using invoke code activity but i working for me.
Can you please find.