Mengirim Email lewat ASP.Net tidak terlalu memusingkan kepala, berikut ini contoh kodenya :
string EmailPengirim="email@pengirim.com";Tetapi dalam develop nanti hati2 dalam hal uji cobanya, email kita akan di kira spam, karena kita sedang develop dan lupa secara terus menerus mengirimkan hal dan alamat yang sama.
string EmailTujuan = "email@tujuan.com";
string Judul = "judul-email";
string UsernameEmail = "username-email";
string PasswordEmail = "password-email";
string SmptServer = "smtp-server";
int portEmailServer = "port-number";
string IsiEmail = "email-body"
MailMessage Email = new MailMessage(EmailPengirim, EmailTujuan, Judul, IsiEmail);
NetworkCredential Credential = new NetworkCredential(UsernameEmail, PasswordEmail);
SmtpClient SmtpServer = new SmtpClient(SmptServer, portEmailServer);
SmtpServer.Credentials = Credential ;
SmtpServer.Send(Email);
No comments:
Post a Comment