Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Send e-mails with a webform

Reply
 
Old 11-03-2008   #1 (permalink)
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.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 = soporte@xxxxxx

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





My System SpecsSystem Spec
Old 11-03-2008   #2 (permalink)
sloan


 
 

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.spaces.live.com/Blo...842A!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" <egnra@xxxxxx> wrote in message
news:Ob2kxBdPJHA.588@xxxxxx
Quote:

> 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 = soporte@xxxxxx
>
> 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
>
>
>
>

My System SpecsSystem Spec
Old 11-04-2008   #3 (permalink)
Esteban GN


 
 

Re: Send e-mails with a webform

Thank you!
It works fine.

KR
"sloan" <sloan@xxxxxx> escribió en el mensaje
news:Ol1YfafPJHA.4576@xxxxxx
Quote:

> If you implement my "Smarter SMTP Settings" solution, you won't get
> screwed with different environments:
>
> http://sholliday.spaces.live.com/Blo...842A!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" <egnra@xxxxxx> wrote in message
> news:Ob2kxBdPJHA.588@xxxxxx
Quote:

>> 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 = soporte@xxxxxx
>>
>> 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
>>
>>
>>
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Cannot Send E-mails- Error Message Recieved- Can recieve e-mails Vista mail
unable to send out e-mails through Windows Mail, incoming mails ar Vista mail
Cannot recieve e-mails, but can send e-mails Vista mail
Prevent multi-submit on webform for user refresh action? .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46