Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
good morning sir,

i read your code and when i apply it shows, i got" your mail not to be send"
sir i am a student and i freely registered in www.kohlihosting.net
sir can u tell me some example to fill it in field below
"    SmtpMail.SmtpServer = "your_server_address";    "

sir then i can figure out what i should write here,
i m using linux hosting,
some detail is given below:

VistaPanel version:2.4.0 RC1
Operating systemLinux
Apache version:2.2.12 (Unix)
PHP version:5.2.10
MySQL version:5.0.84
Skin / Graphics Originally developed by CPSkins.com



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

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    public int sendMail(string to, string cc, string bcc, string subject, string body)
    {
        try
        {

            SmtpMail.SmtpServer = "your_server_address";
            MailMessage msg = new MailMessage();
            msg.From = "your_email_id";
            msg.To = to;
            msg.Cc = cc;
            msg.Bcc = bcc;
            msg.Subject = subject;
            msg.Body = body;
            SmtpMail.Send(msg);
            return (1);
        }
        catch
        {
            return (0);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String to = TextBox1.Text; 
    String cc = ""; 
    String bcc =""; 
    String subject = ""; 
    String body = TextBox2.Text; 
    int status = sendMail(to,cc,bcc,subject,body); 
    if(status == 1) 
        Response.Write("your mail has been sent successfully"); 
    else 
        Response.Write("sorry! your mail could not be sent�"); 
    }
}
Posted
Updated 23-Feb-10 18:23pm
v2

amit _pathak_aadi wrote:
i read your code


What a pity you did not read the guidance on posting a question. Please, please, post your question in the forum at the end of the article.
 
Share this answer
 
amit _pathak_aadi wrote:
SmtpMail.SmtpServer = "your_server_address";


As a developer you really sgould be able to determine that this field needs the internet address (IP address or name) of the SMTP server that handles your email.
 
Share this answer
 
v2
Please check SMTP server ..
You are may be specifing wrong SMTP server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900