Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Send mail

Send mail

Scheduled Pinned Locked Moved ASP.NET
comsysadminhelpworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aasstt
    wrote on last edited by
    #1

    I am unable to send mail using CDOSYS. My code is as follows: - MailMessage msgPsw = new MailMessage(); string strBody = "How r u"; msgPsw.To = "abc@yahoo.com"; msgPsw.From = "aasstt@vsnl.com"; msgPsw.Cc = strDbMailID; msgPsw.Subject = "Hi"; msgPsw.Body = strBody; msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtserver", "server IP address"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendserverport", "25"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); try { SmtpMail.Send(msgPsw); } catch(System.Web.HttpException ehttp) { string strError = ehttp.Message + "" + ehttp.ToString(); LabelErr.Text = strError ; } Can somebody please help me aasstt

    S B 2 Replies Last reply
    0
    • A aasstt

      I am unable to send mail using CDOSYS. My code is as follows: - MailMessage msgPsw = new MailMessage(); string strBody = "How r u"; msgPsw.To = "abc@yahoo.com"; msgPsw.From = "aasstt@vsnl.com"; msgPsw.Cc = strDbMailID; msgPsw.Subject = "Hi"; msgPsw.Body = strBody; msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtserver", "server IP address"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendserverport", "25"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); try { SmtpMail.Send(msgPsw); } catch(System.Web.HttpException ehttp) { string strError = ehttp.Message + "" + ehttp.ToString(); LabelErr.Text = strError ; } Can somebody please help me aasstt

      S Offline
      S Offline
      Steven J Jowett
      wrote on last edited by
      #2

      Here's some vb 2005 code that works Dim smtpMail As New System.Net.Mail.SmtpClient Dim emlMessage As New System.Net.Mail.MailMessage() With emlMessage .From = New System.Net.Mail.MailAddress(emailAddressTextBox.Text, nameTextBox.Text) .Subject = subjectTextBox.Text .Body = messageTextBox.Text .To.Add(emailAddressTextBox.Text) 'you can add as many email addresses as required .IsBodyHtml = False End With With smtpMail .Host = "smtp.domain.com" .DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network .Credentials = New System.Net.NetworkCredential("SmtpServerLogonName", "Password") .Send(emlMessage) End With

      Steve Jowett

      1 Reply Last reply
      0
      • A aasstt

        I am unable to send mail using CDOSYS. My code is as follows: - MailMessage msgPsw = new MailMessage(); string strBody = "How r u"; msgPsw.To = "abc@yahoo.com"; msgPsw.From = "aasstt@vsnl.com"; msgPsw.Cc = strDbMailID; msgPsw.Subject = "Hi"; msgPsw.Body = strBody; msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtserver", "server IP address"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendserverport", "25"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username"); msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); try { SmtpMail.Send(msgPsw); } catch(System.Web.HttpException ehttp) { string strError = ehttp.Message + "" + ehttp.ToString(); LabelErr.Text = strError ; } Can somebody please help me aasstt

        B Offline
        B Offline
        Britney S Morales
        wrote on last edited by
        #3

        Do you have installed the Virtual Mail Service in your Server? These code is at C# language, and use the localhost (IIS) mail Service. private void SendEmailToClient(string to, string bodyMessage) { // System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0 // System.Net.Mail.SmtpClient is the alternate class for this in 2.0 SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try { MailAddress fromAddress = new MailAddress("YOUR EMAIL", "YOUR NAME"); // You can specify the host name or ipaddress of your server // Default in IIS will be localhost smtpClient.Host = "localhost"; //Default port will be 25 smtpClient.Port = 25; //From address will be given as a MailAddress Object message.From = fromAddress; MailAddress toAddress = new MailAddress(to); // To address collection of MailAddress message.To.Add(toAddress); message.Subject = "This is an Email Test"; // CC and BCC optional // MailAddressCollection class is used to send the email to various users // You can specify Address as new MailAddress message.CC.Add("admin@yoursite.com"); // You can specify Address directly as string message.Bcc.Add(new MailAddress("moraleso@fmmb.org")); //Body can be Html or text format //Specify true if it is html message message.IsBodyHtml = false; // Message body content message.Body = bodyMessage; // Send SMTP mail smtpClient.Send(message); //Send process was successful } catch (Exception ex) { Mensaje.Text = "You couldnt send the email" + ex.Message; } } :)

        keep Learning and you never will be out of date...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups