-1
Good afternoon.
I am trying to fire an email through SSIS using the C# code whose email body has a "click here" to open a file that is in a directory. I already tried the HTML schema using "Click here and the VBA schema. I’ve even done it as the topic C# how to send an email containing a hyperlink using System.Net.Mail? could someone help me, please? the code is:
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
public void Main()
{
// TODO: Add your code here
MailMessage msg = new MailMessage("[email protected]", "[email protected]", "Assunto", "Bom dia a todos."+"\r\n" + "\r\n" + "Arquivo atualizado. Para conferir, <a href= \\xxxxx\\xxxxxxx\\xxxx\\bbbbb\\eeeeeeee\\arquivo.xlsx"><"Clique aqui"></a>");
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient("exchange.empresaX.com.br", 587);
client.EnableSsl = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential("[email protected]","SENHA");
client.Send(msg);
Dts.TaskResult = (int)ScriptResults.Success;
}
Good afternoon Cypherpotato, The code compiled, however in the body of the email, is only appearing "Updated file. To check," and does not appear the Click here =(
– fercs89
@fercs89 is because the
clique aqui
was as<"clique aqui">
and that’s html syntax error. I fixed the answer.– CypherPotato
It worked!!! Thank you so much @Cypherpotato !
– fercs89