Hi
I am new to asp.net/c#.i am trying to send email.
Its working fine in some servers but getting below error on one server.
Acc. to my understanding its due to config file.Is it possible 2 config file
in single project.
Need suggestions.

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'certification' does not exist in the current context

Source Error:

Line 29: str += "</table></td></tr>";
Line 30: str += "<tr><td style='background-color:White; font-family:Verdana; font-size:8pt; font-weight:bold; color:Navy; text-align:center;'>Thanks..</td></tr></table>";
Line 31: certification.SMTP(st[a], "Qc certification.com Quality Control Request Details", str);
Line 32: }
Line 33: Label1.Text = "Thanks Your Event Information Registered Sucessfully";


Source File: d:\webdata\qccertification.com\WebSite1\Default.aspx.cs Line: 31

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Mail;
using System.Text;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.MaintainScrollPositionOnPostBack = true;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

      
         string st1 =  "itsmejack.jack@gmail.com"+"-"+"deepakgill1988@yahoo.com"+"-"+"anjlis683@gmail.com";
         string[] st = st1.Split('-');
         for (int a = 0; a < st.Length; a++)
       {
        string str = "Qc certification.com  Quality Control  Request Details" + "<br/>" + " <table align='left' cellpadding='5' cellspacing='1' style='width:100%; border: 1px solid #0099FF; background-color: #99CCFF; font-family:Verdana; font-size:8.5pt;'>";
        str += "<tr><td style='background-color:White; font-family:Verdana; font-size:8pt; font-weight:bold; color:Navy; text-align:center;'> Certification Request Details...</td></tr>";
        str += "<tr><td><table cellpadding='5' cellspacing='1' style='width: 100%;  text-align:center; vertical-align:top;'><tr style='background-color: #FFFFFF;'><td style='width:20%; text-align:right; vertical-align:top;'><b>Name:</b></td><td style='width:80%; text-align:left; vertical-align:top;'>" + TextBox1.Text + "</td></tr><tr style='background-color: #FFFFFF;'><td style='width:20%; text-align:right; vertical-align:top;'><b>Email Address:</b></td><td style='width:80%; text-align:left; vertical-align:top;'>" + TextBox2.Text + "</td></tr><tr style='background-color: #FFFFFF;'><td style='width:20%; text-align:right; vertical-align:top;'><b>Phone:</b></td><td style='width:80%; text-align:left; vertical-align:top;'>" + TextBox3.Text + " &nbsp;</td></tr><tr style='background-color: #FFFFFF;'><td style='width:20%; text-align:right; vertical-align:top;'><b>Certification:</b></td><td style='width:80%; text-align:left; vertical-align:top;'>" + DropDownList1.SelectedItem.ToString() + " &nbsp;</td></tr>";
        str += "<tr style='background-color: #FFFFFF;'><td style='width:20%; text-align:right; vertical-align:top;'><b>City:</b></td><td style='width:80%; text-align:left; vertical-align:top;'>" + TextBox4.Text + " &nbsp;</td></tr>";
        str += "</table></td></tr>";
        str += "<tr><td style='background-color:White; font-family:Verdana; font-size:8pt; font-weight:bold; color:Navy; text-align:center;'>Thanks..</td></tr></table>";
        certification.SMTP(st[a], "Qc certification.com  Quality Control  Request Details", str);
        }
        Label1.Text = "Thanks Your Event Information Registered Sucessfully";
    }
}

certification class name

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Net.Mail;
using System.Text;

/// <summary>
/// Summary description for certification
/// </summary>
public class certification
{
    public static void SMTP(string to, string subject, string body)
    {

        MailMessage mailMsg = new MailMessage();
        mailMsg.From = new MailAddress("itsmejack.jack@gmail.com");
        mailMsg.To.Add(to);
        mailMsg.Subject = subject;
        mailMsg.IsBodyHtml = true;
        mailMsg.BodyEncoding = Encoding.UTF8;
        mailMsg.Body = body;
        mailMsg.Priority = MailPriority.High;
        SmtpClient client = new SmtpClient();
        client.Credentials = new NetworkCredential("itsmejack.jack@gmail.com", "01681248669");
        client.Host = "smtp.gmail.com";
        client.Port = 587; //or use 465     
        client.EnableSsl = true;
        try
        {
            //you can also call client.Send(msg)
            client.Send(mailMsg);
        }
        catch (SmtpException)
        {

        }

    }
}

Certification class not getting while sending email.

Add this Certification class in APP_Code folder for your solution for solving email issue

You might want to edit the post to remove your email and password...

Thanks,

Certification class already in APP_Code folder.

Certification class not getting while sending email.

Add this Certification class in APP_Code folder for your solution for solving email issue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.