473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mailMessage As New MailMessage()

mailMessage.From = TextBox1.Text

mailMessage.To = so*****@ccd.com

mailMessage.Subject = TextBox2.Text

mailMessage.BodyFormat = MailFormat.Text

mailMessage.Body = TextBox3.Text

mailMessage.Priority = MailPriority.Normal

SmtpMail.SmtpServer = "server05"

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

SmtpMail.Send(mailMessage)

Response.Redirect("casesend.aspx")

End Sub

End Class


Nov 3 '08 #1
2 1665
If you implement my "Smarter SMTP Settings" solution, you won't get screwed
with different environments:

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
But no, you have to set the
System.Net.Mail.SmtpClient.Port
property (2.0)
Or in 1.1
MailMessage emailMsg = new MailMessage();
emailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
portNum);
That's why my Wrapper Stuff is "smarter".

"Esteban GN" <eg***@hotmail.comwrote in message
news:Ob*************@TK2MSFTNGP06.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.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mailMessage As New MailMessage()

mailMessage.From = TextBox1.Text

mailMessage.To = so*****@ccd.com

mailMessage.Subject = TextBox2.Text

mailMessage.BodyFormat = MailFormat.Text

mailMessage.Body = TextBox3.Text

mailMessage.Priority = MailPriority.Normal

SmtpMail.SmtpServer = "server05"

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

SmtpMail.Send(mailMessage)

Response.Redirect("casesend.aspx")

End Sub

End Class


Nov 3 '08 #2
Thank you!
It works fine.

KR
"sloan" <sl***@ipass.netescribió en el mensaje
news:Ol**************@TK2MSFTNGP03.phx.gbl...
If you implement my "Smarter SMTP Settings" solution, you won't get
screwed with different environments:

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
But no, you have to set the
System.Net.Mail.SmtpClient.Port
property (2.0)
Or in 1.1
MailMessage emailMsg = new MailMessage();
emailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
portNum);
That's why my Wrapper Stuff is "smarter".

"Esteban GN" <eg***@hotmail.comwrote in message
news:Ob*************@TK2MSFTNGP06.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.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mailMessage As New MailMessage()

mailMessage.From = TextBox1.Text

mailMessage.To = so*****@ccd.com

mailMessage.Subject = TextBox2.Text

mailMessage.BodyFormat = MailFormat.Text

mailMessage.Body = TextBox3.Text

mailMessage.Priority = MailPriority.Normal

SmtpMail.SmtpServer = "server05"

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

SmtpMail.Send(mailMessage)

Response.Redirect("casesend.aspx")

End Sub

End Class



Nov 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Steve Horrillo | last post by:
I can't figure out why this script won't insert the subject in the email and why can't I control the font and size being used? I'm not sure where to post this. Let me know where if this is OT. ...
0
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it...
6
by: John J. Hughes II | last post by:
I have a service that needs to send e-mail alerts. I have been attempting to use the System.Net.Mail function from .NET but this seems to require the IIS be installed and running. Since some of...
13
by: Manfred Braun | last post by:
Hi All, I am trying to understand the blocking method socket.Send(). The call blocks as expected, but does this mean, it returnes after the underlying TCP layer got a confirmation, that the send...
3
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
3
by: ultr | last post by:
Hello, I have read that send() may not send whole message and returns the nuber of bytes sent, so that we can handle the rest of the message. Is it true, because i have tested sending even 1MB...
11
by: hazz | last post by:
smtpClient.Send(message) is causing me problems as per specifics in the trace below. Email is sent but not without this error typically upon sending the second email, but sometimes when running...
15
by: cj | last post by:
How can I get a button in VB to send the contents of a text box via email in a manner similar to the "Send To\Mail Recipient" functionality that you can select via right clicking a file in Windows...
0
by: Xionbox | last post by:
Hello everybody, The error I have seems very easy to solve, but for some odd reason I can't seem to solve it. Anyways, here's my "setup". I created a server running on localhost:1200 (telnet...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.