I'm analyzing a C# project which have mailing functionality. Due to some restrictions I cant run the project. I got few queries while analyzing the code
MailAddress toMailAddress = new MailAddress(strToMail);
MailAddress fromMailAddress = new fromMailAddress(strFromMail);
SmtpClient smtpClient = new SmtpClient(smtpServer);
String strBody = strMessage;
MailMessage msg = New MailMessage();
msg.From = fromMailAddress
msg.To.Add(toMailAddress);
msg.Subject = strSubject;
smtpClient.Send(msg);
- Here the from address is coming from database but no credentials stored in the DB for the corresponding email or passed through code either. Does that mean I can send email from any account without their credentials?
- Is outlook necessary to send mails? If so, outlook is configured to different account then the from address in the code, will it throw any error?