Send e-mails with a webform

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Esteban GN

    Send e-mails with a webform

    Hi group,
    I have the following code:
    It works fine, but I want to use another smtp server and it use the TCP Port
    5000
    There is a way to change the default smtp port (25) with aditional code?
    Thanks in advance.


    Imports System.Web.Mail

    Partial Class AddCasos

    Inherits System.Web.UI.P age

    Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
    System.EventArg s) Handles Button1.Click

    Dim mailMessage As New MailMessage()

    mailMessage.Fro m = TextBox1.Text

    mailMessage.To = soporte@ccd.com

    mailMessage.Sub ject = TextBox2.Text

    mailMessage.Bod yFormat = MailFormat.Text

    mailMessage.Bod y = TextBox3.Text

    mailMessage.Pri ority = MailPriority.No rmal

    SmtpMail.SmtpSe rver = "server05"

    'mail server used to send this email. modify this line based on your mail
    server

    SmtpMail.Send(m ailMessage)

    Response.Redire ct("casesend.as px")

    End Sub

    End Class




  • sloan

    #2
    Re: Send e-mails with a webform

    If you implement my "Smarter SMTP Settings" solution, you won't get screwed
    with different environments:

    http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!138.entry


    But no, you have to set the
    System.Net.Mail .SmtpClient.Por t
    property (2.0)


    Or in 1.1
    MailMessage emailMsg = new MailMessage();
    emailMsg.Fields .Add("http://schemas.microso ft.com/cdo/configuration/smtpserverport" ,
    portNum);


    That's why my Wrapper Stuff is "smarter".





    "Esteban GN" <egnra@hotmail. comwrote in message
    news:Ob2kxBdPJH A.588@TK2MSFTNG P06.phx.gbl...
    Hi group,
    I have the following code:
    It works fine, but I want to use another smtp server and it use the TCP
    Port 5000
    There is a way to change the default smtp port (25) with aditional code?
    Thanks in advance.
    >
    >
    Imports System.Web.Mail
    >
    Partial Class AddCasos
    >
    Inherits System.Web.UI.P age
    >
    Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    >
    Dim mailMessage As New MailMessage()
    >
    mailMessage.Fro m = TextBox1.Text
    >
    mailMessage.To = soporte@ccd.com
    >
    mailMessage.Sub ject = TextBox2.Text
    >
    mailMessage.Bod yFormat = MailFormat.Text
    >
    mailMessage.Bod y = TextBox3.Text
    >
    mailMessage.Pri ority = MailPriority.No rmal
    >
    SmtpMail.SmtpSe rver = "server05"
    >
    'mail server used to send this email. modify this line based on your mail
    server
    >
    SmtpMail.Send(m ailMessage)
    >
    Response.Redire ct("casesend.as px")
    >
    End Sub
    >
    End Class
    >
    >
    >
    >

    Comment

    • Esteban GN

      #3
      Re: Send e-mails with a webform

      Thank you!
      It works fine.

      KR
      "sloan" <sloan@ipass.ne tescribió en el mensaje
      news:Ol1YfafPJH A.4576@TK2MSFTN GP03.phx.gbl...
      If you implement my "Smarter SMTP Settings" solution, you won't get
      screwed with different environments:
      >
      http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!138.entry
      >
      >
      But no, you have to set the
      System.Net.Mail .SmtpClient.Por t
      property (2.0)
      >
      >
      Or in 1.1
      MailMessage emailMsg = new MailMessage();
      emailMsg.Fields .Add("http://schemas.microso ft.com/cdo/configuration/smtpserverport" ,
      portNum);
      >
      >
      That's why my Wrapper Stuff is "smarter".
      >
      >
      >
      >
      >
      "Esteban GN" <egnra@hotmail. comwrote in message
      news:Ob2kxBdPJH A.588@TK2MSFTNG P06.phx.gbl...
      >Hi group,
      >I have the following code:
      >It works fine, but I want to use another smtp server and it use the TCP
      >Port 5000
      >There is a way to change the default smtp port (25) with aditional code?
      >Thanks in advance.
      >>
      >>
      >Imports System.Web.Mail
      >>
      >Partial Class AddCasos
      >>
      >Inherits System.Web.UI.P age
      >>
      >Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
      >System.EventAr gs) Handles Button1.Click
      >>
      >Dim mailMessage As New MailMessage()
      >>
      >mailMessage.Fr om = TextBox1.Text
      >>
      >mailMessage. To = soporte@ccd.com
      >>
      >mailMessage.Su bject = TextBox2.Text
      >>
      >mailMessage.Bo dyFormat = MailFormat.Text
      >>
      >mailMessage.Bo dy = TextBox3.Text
      >>
      >mailMessage.Pr iority = MailPriority.No rmal
      >>
      >SmtpMail.SmtpS erver = "server05"
      >>
      >'mail server used to send this email. modify this line based on your mail
      >server
      >>
      >SmtpMail.Send( mailMessage)
      >>
      >Response.Redir ect("casesend.a spx")
      >>
      >End Sub
      >>
      >End Class
      >>
      >>
      >>
      >>
      >
      >

      Comment

      Working...