Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7647787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:33:01+00:00 2026-05-31T10:33:01+00:00

After hours and hours of head scratching and not knowing WHY my site’s code

  • 0

After hours and hours of head scratching and not knowing WHY my site’s code used to work on the old server and now on the new server it just doesn’t work (changed IP of mailserver, used subdomain address for the server, changed ports, tried 25, 26, 587 and anything suggested by the server admins) I have finally stumbled through the real issue (I think) which is that the hosting requires authentication.

I have no idea how to add authentication to my old code and the support doesn’t even reply to my tickets anymore. Any help is appreciated.

This is the part in the registration file which sends the activation code:

MailClass.MailGonder("info@mysite.com", TxtEMail.Text, "Activation", body, "info@mysite.com", "emailpassword", "mail.mysite.com", 587);

And this is the Mail_Class.cs file which handles the mail sending of all pages (there are other pages which also use this other than the registration page):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Net;

namespace Sngl
{
public class MailClass
{
    public MailClass() { }

    public static void MailGonder(string kimden, string kime, string title, string body, string senderEmail, string senderPassword, string smtpServer, int port)
    {
        try
        {
            System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage(kimden, kime, title, body);
            MyMailMessage.IsBodyHtml = true;
            MyMailMessage.Priority = System.Net.Mail.MailPriority.High;
            System.Net.NetworkCredential mailAuthentication = new
            System.Net.NetworkCredential(senderEmail, senderPassword);
            System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient(smtpServer, port);
            mailClient.EnableSsl = false;
            mailClient.UseDefaultCredentials = false;
            mailClient.Credentials = mailAuthentication;
            mailClient.Send(MyMailMessage);

            PropertyClass.Result = true;

        }
        catch (Exception ex)
        {
            PropertyClass.Result = false;
            PropertyClass.Message = ex.Message;
        }
    }
}
}

Error message shown is: “Failure sending mail.”
No more details are given.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:33:02+00:00Added an answer on May 31, 2026 at 10:33 am

    The link you gave must be for a really old posting because the example it gives uses obsolete .net classes. I’ve converted it to c# for you below, but i’ve got no idea if it will work as I’ve never used this stuff before.

    using System;
    using System.Web.Mail;
    
    namespace Sngl
    {
        public class MailClass
        {
            public MailClass() { }
    
            public static void MailGonder(string kimden, string kime, string title, string body, string senderEmail, string senderPassword, string smtpServer, int port)
            {
                try
                {
                    var message = new MailMessage
                    {
                        From = kimden,
                        To = kime,
                        Subject = title,
                        Body = body
                    };
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = smtpServer;
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = port;
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 1;
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = senderEmail;
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = senderPassword;
                    message.Fields["http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"] = 60;
    
                    SmtpMail.SmtpServer = smtpServer;
                    SmtpMail.Send(message);
    
                    PropertyClass.Result = true;
                }
                catch (Exception ex)
                {
                    PropertyClass.Result = false;
                    PropertyClass.Message = ex.Message;
                    throw;
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I finally got this code to work after hours of toiling: Dim path
After two hours of head scratching and googling - i'm stuck! As per the
new to this site, but my head is absolutely killing me after trying for
After hours of trying to wrap my head around pattern matching, I'm throwing the
After banging my head against the wall over this for the past few hours
After three hours I'm going to stop banging my head on the wall and
I'm scratching my head over a MySQL subquery. And it's only after scratching for
Okay, after pounding my head against the wall for about 2 hours, I need
I've been banging my head over this issue for about 5 hours now, I'm
After hours of debugging, it appears to me that in FireFox, the innerHTML of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.