José Perez
asked on
Asp.Net/C# WebPage not sending emails.
Hi,
we develop using Visual Studio 2013.
A client has requested us to develop a webpage that has to send emails from our network to ouside clients. We have not been able to send emails yet. We think the issue is that our client uses Office365 in the cloud for their email accounts.
Our code is the following:
we develop using Visual Studio 2013.
A client has requested us to develop a webpage that has to send emails from our network to ouside clients. We have not been able to send emails yet. We think the issue is that our client uses Office365 in the cloud for their email accounts.
Our code is the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
namespace SGTagler.Controller
{
public class envio_email
{
/* Cliente SMTP
* Gmail: smtp.gmail.com puerto:587
* Hotmail: smtp.live.com puerto:25
*/
SmtpClient server = new SmtpClient("smtp.office365.com", 587);
public envio_email()
{
/* Autenticacion en el Servidor
* Utilizaremos nuestra cuenta de correo
*
* Direccion de Correo (Gmail o Hotmail)
* y Contrasena correspondiente
*/
server.Credentials = new System.Net.NetworkCredential("asesoriainformatica1@tagler.cl", "1xxxx4");
//Habilitar o deshabilitar conexion segura
server.EnableSsl = true;
}
public void MandarCorreo(MailMessage mensaje)
{
server.Send(mensaje);
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
client.TargetName = "STARTTLS/smtp.office365.c