473,320 Members | 2,006 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,320 software developers and data experts.

Email from web

Hi

I was using MailMessage object vs2003 to send email form my webform. In
vs2005 it says MailMessage is obsolete. What should I use instead? Could
someone please give me an example? My smtp server needs authentication
(user/pass).

Thanks

Regards
Mar 29 '06 #1
3 1181

I have 2.0 example code at:
http://spaces.msn.com/sholliday/ 2/8/2006 entry
if it helps, please leave a comment.

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi

I was using MailMessage object vs2003 to send email form my webform. In
vs2005 it says MailMessage is obsolete. What should I use instead? Could
someone please give me an example? My smtp server needs authentication
(user/pass).

Thanks

Regards

Mar 29 '06 #2
I am using below. Is there a simple replacement for this?

Thanks

Imports System.web.Mail

Dim Mailer As MailMessage

Mailer = New MailMessage
Mailer.From = "from addrewss here"
Mailer.To = "to address here"
Mailer.Subject = "Feedback via Web"
Mailer.Body = Str
Mailer.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer = "smtp mail server"
SmtpMail.Send(Mailer)
"sloan" <sl***@ipass.net> wrote in message
news:eb**************@TK2MSFTNGP11.phx.gbl...

I have 2.0 example code at:
http://spaces.msn.com/sholliday/ 2/8/2006 entry
if it helps, please leave a comment.

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi

I was using MailMessage object vs2003 to send email form my webform. In
vs2005 it says MailMessage is obsolete. What should I use instead? Could
someone please give me an example? My smtp server needs authentication
(user/pass).

Thanks

Regards


Mar 29 '06 #3


The code from the blog is below:

You don't have the serv object (which is at the blog), so you'll have to
improvise.

string sBody = "This email was sent:" + Environment.NewLine
+ serv.SmtpServerName + Environment.NewLine + serv.SmtpUserName;
string toAddress = "pu**********@here.com";
string emailSubject = "2.0 Test!";

System.Net.Mail.SmtpClient email = new
System.Net.Mail.SmtpClient();
email.Host = serv.SmtpServerName;

if (serv.PortNumber.Length > 0)
{
email.Port = Convert.ToInt32(serv.PortNumber);

}

switch (serv.AuthenicationMethod)
{
case AuthenticationType.None:
break;

case AuthenticationType.Basic:

email.DeliveryMethod =
System.Net.Mail.SmtpDeliveryMethod.Network;

email.UseDefaultCredentials = false;

email.Credentials = new
NetworkCredential(serv.SmtpUserName, serv.SmtpUserPassword);
break;

case AuthenticationType.SSL:

email.EnableSsl = true;

email.Credentials = new
NetworkCredential(serv.SmtpUserName, serv.SmtpUserPassword);

//email.DeliveryMethod =
System.Net.Mail.SmtpDeliveryMethod.Network ;

break;

}

System.Net.Mail.MailMessage mailMsg = new
System.Net.Mail.MailMessage(serv.DefaultFromAddres s, toAddress,
emailSubject, sBody);
mailMsg.IsBodyHtml = true;
email.Send(mailMsg);

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi

I was using MailMessage object vs2003 to send email form my webform. In
vs2005 it says MailMessage is obsolete. What should I use instead? Could
someone please give me an example? My smtp server needs authentication
(user/pass).

Thanks

Regards

Mar 29 '06 #4

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

Similar topics

12
by: Chuck Anderson | last post by:
Can anyone point me in the right direction? I want to use Php to automate confirmation of someone joining an email list by them replying to an email (so they don't have to have a browser?). I...
4
by: dmiller23462 | last post by:
So here's my problem.....I need to set up different email distributions based on which option in the following Select form has been chosen....For instance if "Putaway" is chosen it needs to email...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
2
by: BSG-SMTP-Gateway | last post by:
The following message sent by this account has violated system policy: Connection From: 64.253.55.90 From: python-list@python.org To: terriss@birdsall.com, q4dzsAEAAAAA@birdsall.com,...
26
by: libsfan01 | last post by:
Hi all! Can anyone show me how to check and email field on a form for the existence of these two characters. Kind regards Marc
3
by: g0c | last post by:
hi, how to hide or replace email addresses in php mail function with something like "group" so the email addresses to which email is sent are not visible ? i have : $subs = "email1@dot.com,...
3
by: Erik Johnson | last post by:
THE GOAL: I need to send an email with a simple ASCII text body and an attached HTML file. I have scripts that send basic emails via the smtplib module that don't have any attachements and that...
15
by: Craig Hurley | last post by:
Hello, user@x.com receives an email from user@a.com. I want to forward that email to user@y.com. I want the contents/header to remain intact, with the exception of adding "X-Forwarded-For". ...
3
by: IGD | last post by:
I don't know if this is the right place to post this or not. If not, could someone direct me elsewhere where I would find more information on how to solve my problem? Thanks! My problem is this:...
27
matheussousuke
by: matheussousuke | last post by:
I'm having trouble with e-mail sending, I mean, the website is suposed to send a confirmation email after sign up, but it gets like text plain instead of HTML May someone help me, please? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.