• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1225
  • Last Modified:

Send email programatically in asp.net from discountasp

This worked in my previous site host:

MailMessage mail = new MailMessage();

        mail.IsBodyHtml = true;

        //set the addresses
        mail.From = new MailAddress(strUserEmail);
        mail.To.Add(new MailAddress("Support@StockPickerMax.com"));

mail.Subject... etc
     //  SmtpClient smtp = new SmtpClient("mail.stockpickermax.com", 8889); previous host, worked
       
     SmtpClient smtp = new SmtpClient("smtp.stockpickermax.com", 8889);
// current host(discountasp) does not work.
         
            smtp.Send(mail);

Error on Send(mail)

No connection could be made because the target machine actively refused it 64.79.170.142:8889]

What should I change? Is 8889 the correct port for discountasp?
0
Dovberman
Asked:
Dovberman
3 Solutions
 
malikirfan28Commented:
Kindly confirm from your hosted providers that they have configured SMTP on their server and get the SMTP settings from them.
If they have configured it locally  (which most service provider have) then you can use "localhost" as a SMTP server. Here will be an example for you.

MailMessage mail = new MailMessage();

        mail.IsBodyHtml = true;

        //set the addresses
        mail.From = new MailAddress(strUserEmail);
        mail.To.Add(new MailAddress("Support@StockPickerMax.com"));
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send(mail);

0
 
malikirfan28Commented:
You can also check that either local SMTP is configured or not by using following command in command prompt on that machine.

telnet localhost 25.

Kindly also note that normally SMTP is configured on port 25. Check with your providers if they have configured it on another port.

Have a look here. It may also help you.
0
 
nrip_cheemaCommented:
seems like in previous the smtp service was running on non-default port (8889) (or Nated at the end firewall) . You can either request the same or ask for new configuration.

If you are sure that nothing is changed at the server end; so you can also check the firewall at the pc/server on which you are running the code. It may happen that communication is blocked on that machine on non standard ports.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
SamMacPCCommented:
Hosts are really good about telling you what their setup is. They will normally have pre-scripted forms available in their cpanel. Who is your host? Have you given them a copy of that script? What do they say? Is there a specific port or server they want you to send through? Does the host require authentication?

Probably not.

--Sam
0
 
DovbermanAuthor Commented:
The host provided the information I needed:

               SmtpClient smtp = new SmtpClient("smtp.stockpickermax.com", 25);
                NetworkCredential Credentials = new NetworkCredential("support@stockpickermax.com", "mypassword");
                smtp.Credentials = Credentials;
                 smtp.Send(mail);

Thanks for your help.
0
 
DovbermanAuthor Commented:
Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now