I have set up a system where registration and login are required, and as part of teh registration process I confirm Email addresses by sending a message containing an authorization code - all pretty standard stuff.
The problem is that the only way I have found to send the email needs my cpanel login id and password, which I don't want to include in the ASP.NET code, or even in the web.config file if I can help it. Is there some authentication I have missed which doesn't use this?
The problem is that the only way I have found to send the email needs my cpanel login id and password, which I don't want to include in the ASP.NET code, or even in the web.config file if I can help it. Is there some authentication I have missed which doesn't use this?
Code:
[SIZE=2]System.Net.Mail.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MailMessage[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] mail = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Net.Mail.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MailMessage[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]();[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] body = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Hello "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + mu.UserName + [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" and thank you for registering your new account...<br/>";[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]mail.Body = body;[/SIZE]
[SIZE=2]mail.IsBodyHtml = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]mail.To.Add([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MailAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](mu.Email));[/SIZE]
[SIZE=2]mail.From = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Net.Mail.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MailAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"NoReply@XXX.x10hosting.com"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"NoReply@XXX.x10hosting.com"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Encoding[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].UTF8);[/SIZE]
[SIZE=2]mail.Subject = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"New account registration"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]mail.SubjectEncoding = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Encoding[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].UTF8;[/SIZE]
[SIZE=2]mail.Priority = System.Net.Mail.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MailPriority[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].High;[/SIZE]
[SIZE=2]System.Net.Mail.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]SmtpClient[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] smtp = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Net.Mail.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]SmtpClient[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]();[/SIZE]
[SIZE=2]smtp.Host = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"mail.XXX.x10hosting.com"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]smtp.Port = 26;[/SIZE]
[SIZE=2]smtp.Credentials = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] System.Net.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]NetworkCredential[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"<my log in id>"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"<my log in password>"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]smtp.Send(mail);[/SIZE]