Click here to Skip to main content
15,887,585 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Upload file without file uploade control Pin
Abhishek Sur21-Nov-09 5:40
professionalAbhishek Sur21-Nov-09 5:40 
AnswerRe: Upload file without file uploade control Pin
Abhijit Jana21-Nov-09 19:58
professionalAbhijit Jana21-Nov-09 19:58 
AnswerRe: Upload file without file uploade control Pin
April Fans24-Nov-09 0:48
April Fans24-Nov-09 0:48 
Questionsending mails through webservices Pin
shankbond20-Nov-09 22:54
shankbond20-Nov-09 22:54 
AnswerRe: sending mails through webservices Pin
sashidhar20-Nov-09 23:04
sashidhar20-Nov-09 23:04 
GeneralRe: sending mails through webservices Pin
shankbond21-Nov-09 0:40
shankbond21-Nov-09 0:40 
GeneralRe: sending mails through webservices Pin
sashidhar21-Nov-09 0:59
sashidhar21-Nov-09 0:59 
GeneralRe: sending mails through webservices Pin
shankbond21-Nov-09 1:09
shankbond21-Nov-09 1:09 
Hi,
here is the code:

protected void Button4_Click(object sender, EventArgs e)
    {
        testingservice service = new testingservice();
        AsyncCallback callback = new AsyncCallback(hello);
        service.BeginSendMailGmail1(TextBoxto.Text.ToString(), TextBoxcc.Text.ToString(), TextBoxbcc.Text.ToString(), TextBoxbody.Text.ToString(), TextBoxsubject.Text.ToString(), TextBoxusername.Text.ToString(), TextBoxpassword.Text.ToString(), TextBoxserver.Text.ToString(), TextBoxport.Text.ToString(), TextBoxdisplayname.Text.ToString(),callback,sender);
        Response.Redirect("default4.aspx");
    }


here is the other method but it will always be completed =true

void hello(IAsyncResult result) 
    {
        if (!result.IsCompleted)
        {
            Response.Write("failed");
        }
    }


the code for webservice:

[WebMethod]
    

    public string  SendMailGmail1(string To, string Cc, string Bcc, string body,string subject, string user_name, string password, string server_name, string portnumber, string display_name)
    {
       
        SmtpClient client = new SmtpClient();
        MailMessage message = new MailMessage();
        client.Port = Convert.ToInt32(portnumber);
        client.Host = server_name;
        client.UseDefaultCredentials = true;
        client.Credentials = new System.Net.NetworkCredential(user_name, password);
        client.EnableSsl = true;
        try
        {
            message = new MailMessage(new MailAddress(user_name, display_name), new MailAddress(To));
            if (Cc != "")
            {
                string[] array1 = Cc.Split(',');
                for (int i = 0; i < array1.Length; i++)
                {
                    message.CC.Add(array1[i].ToString());
                }

            }
            if (Bcc != "")
            {
                string[] array2 = Bcc.Split(',');
                for (int i = 0; i < array2.Length; i++)
                {
                    message.Bcc.Add(array2[i].ToString());
                }

            }

            message.Body = body;
            message.Subject = subject;
            message.IsBodyHtml = true;
            client.Send(message);
            message.Dispose();
            return "sent successfully";
            
        }
        catch (Exception ex)
        {
            return ex.Message.ToString() + "----" + ex.InnerException.ToString();
        }
    }


Thanks
Shankbond

GeneralRe: sending mails through webservices Pin
sashidhar21-Nov-09 1:20
sashidhar21-Nov-09 1:20 
GeneralRe: sending mails through webservices Pin
sashidhar21-Nov-09 1:23
sashidhar21-Nov-09 1:23 
GeneralRe: sending mails through webservices Pin
shankbond21-Nov-09 2:27
shankbond21-Nov-09 2:27 
GeneralRe: sending mails through webservices Pin
shankbond24-Nov-09 20:58
shankbond24-Nov-09 20:58 
GeneralRe: sending mails through webservices Pin
sashidhar24-Nov-09 21:23
sashidhar24-Nov-09 21:23 
GeneralRe: sending mails through webservices Pin
sashidhar25-Nov-09 1:13
sashidhar25-Nov-09 1:13 
QuestionProblem in maintaining same size of page Pin
rhtbhegade20-Nov-09 22:10
rhtbhegade20-Nov-09 22:10 
AnswerRe: Problem in maintaining same size of page Pin
ais0720-Nov-09 22:29
ais0720-Nov-09 22:29 
AnswerRe: Problem in maintaining same size of page Pin
John Bracey21-Nov-09 1:41
John Bracey21-Nov-09 1:41 
QuestionProblem with FireFox!! Pin
Sr...Frank20-Nov-09 22:09
Sr...Frank20-Nov-09 22:09 
AnswerRe: Problem with FireFox!!..Modified..! Pin
sashidhar20-Nov-09 22:22
sashidhar20-Nov-09 22:22 
GeneralRe: Problem with FireFox!!..Modified..! Pin
Sr...Frank20-Nov-09 23:25
Sr...Frank20-Nov-09 23:25 
GeneralRe: Problem with FireFox!!..Modified..! Pin
sashidhar20-Nov-09 23:26
sashidhar20-Nov-09 23:26 
QuestionHow i write Java script Function for validaing inner Gridview Checkbox Pin
Rameez Raja20-Nov-09 20:17
Rameez Raja20-Nov-09 20:17 
AnswerRe: How i write Java script Function for validaing inner Gridview Checkbox Pin
sashidhar20-Nov-09 20:30
sashidhar20-Nov-09 20:30 
GeneralRe: How i write Java script Function for validaing inner Gridview Checkbox Pin
Rameez Raja20-Nov-09 20:45
Rameez Raja20-Nov-09 20:45 
GeneralRe: How i write Java script Function for validaing inner Gridview Checkbox Pin
Locke Duan22-Nov-09 2:55
Locke Duan22-Nov-09 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.