weggetor / BBContact

The bitboxx bbcontact module is a DNN module for providing a simple configurable contact form with easy setup and email notification. The minimum DNN Version for this module is 06.01.00 !
0 stars 0 forks source link

email validation #1

Closed teambound closed 7 years ago

teambound commented 7 years ago

Could you explain how bbcontact validates the from email address. I enter valid email in the from email field and the module throws an error when the form is sent

The module is on a number of child portals with the site smtp settings set to host. The host and site smtp settings when tested sends fine with no errors. When I send using bbcontact I get this error.

System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'mail.teambound.net:2525' at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at Bitboxx.DNNModules.BBContact.View.SendContactMail() at Bitboxx.DNNModules.BBContact.View.cmdSend_Click(Object sender, EventArgs e) Server Name: generic262

If I use the dnn core feedback module, the email sends fine.

Carl

weggetor commented 7 years ago

Hi Carl, looking at the error message it's not a problem with the validation of an email address but the configured mailserver at mail.teambound.net, port 2525 could not be connected. Don't know why - I'm only using standard .NET mail functionality and the smtp settings from the host. Googling the error shows hints to security, DNS or proxy related issues. Sorry, can't help here.

teambound commented 7 years ago

Hi Torsten - thanks for the quick reply.

I thought that too but the smpt test in both the host and admin settings send fine as well as other portal emails/notifications. If I put the core feedback module on the page, it sends ok too. So while it appears that the connection can't be made, I think there is something in the module that might not be picking up something correctly. You mentioned that you use the smpt settings from the host. What if a child portal is using a site smtp setting and not host?

Thanks again!

weggetor commented 7 years ago

Hi Carl, sorry for replying so late. As I remember there was no portal setting when I wrote this module, so it only fetches the host smtp settings:

            string smtpServer = DotNetNuke.Entities.Host.Host.SMTPServer;
            string smtpAuthentication = DotNetNuke.Entities.Host.Host.SMTPAuthentication;
            string smtpUsername = DotNetNuke.Entities.Host.Host.SMTPUsername;
            string smtpPassword = DotNetNuke.Entities.Host.Host.SMTPPassword;

And its using ( in opposite to the DNN send email method which only works with plain text mails) the standard .NET routine for sending the mail:

            SmtpClient emailClient = new SmtpClient(smtpServer);
            if (smtpAuthentication == "1")
            {
                System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(smtpUsername, smtpPassword);
                emailClient.UseDefaultCredentials = false;
                emailClient.Credentials = SMTPUserInfo;
            }
            emailClient.Send(mail);

That's all. Very simple and should normally work.