This project has moved. For the latest updates, please go here.

Email Settings over Production Server

Feb 27, 2012 at 10:47 AM

Hi ,

We have tested Ticket Desk(TicketDesk MVC 2.0.1 binaries) in localhost with gmail settings and it was working fine.

Then we have hosted the same into Production server with my production server smtp details as follows.

<smtp deliveryMethod="Network">
        <network host="mysmtp" port="25" defaultCredentials="true"/>
      </smtp>
    </mailSettigs>

and Admin settings are:

Site Root Url For Email:  http://ProductionServerIP.

From Email Address: do-not-reply@test.com

But Email functionality is not working. Do I need to change any other settings specific to Production Server.

Can you please let me know if any changes required for admin settings/web.config file.

Thanks and Regards

Mastan

Coordinator
Feb 27, 2012 at 8:28 PM

That looks about right to me. Of course, the production settings depend on how the production environment is setup, but what you are showing is a pretty standard SMTP setup.

In general, when having SMTP issues, I recommend creating the most simple web application you can that sends an email... basically a test aspx page with just enough code to send a hard-coded message over SMTP, and a web.config with the SMTP settings. Confirm the settings and emails work in the simplest situation possible, then work from there.  

Feb 28, 2012 at 9:02 AM

Yes Stephen,

I have created sample application and executed in server.

          string from = "test@gmail.com";
            string to = "test123@hotmail.com";
            string subject = "Test Mail";
            string body="Test body";
            SmtpMail.SmtpServer = "smtpserverName";
            SmtpMail.Send(from, to, subject, body);

Its working fine.  Then What else need to change in config file of Ticket Desk.

Please share with me if you have any work around.

Thanks

Mastan

Coordinator
Feb 28, 2012 at 4:27 PM

Sorry, I just don't have enough information to offer a work around.

TicketDesk doesn't do anything unusual in how it sends email. It uses System.Net.Mail in a fairly simplistic way. 

In your test code, you appear to be using System.Web.Mail, which is an older mail library. TicketDesk uses the newer System.Net.Mail namespace instead.  Also, when testing, you want to make your test app rely on the web.config file for the settings instead of supplying them explicitly in the code.

Something like this:

using System.Net.Mail;

public void MyTest()
{
	SmtpClient client = new SmtpClient();

	MailAddress fromAddr = new MailAddress("test@test.com", "tester");

	MailAddress toAddr = new MailAddress("person@person.com", "person name");

	MailMessage msg = new MailMessage(fromAddr, toAddr);
	msg.Subject = "testing something";

	msg.Body = "some text body (plain text)";  

	//relies on the web.config for the SMTP server, port, and related settings.

	client.Send(msg);
}
 
I can't test this (having a problem with my developer laptop atm), but the code above is a hacked up version of what's in the DefaultSmtpEmailHandlerService in TicketDesk. If you can make this work with settings from web.config, then you'll have confirmed the configuration you need for ticketdesk. Otherwise, TicketDesk's other email related settings are all available from the on-screen admin tools.