.NETGURU
Mail
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-mail' list.


Sachin Mhatre
Can anybody give me good example of sending a mail through ASP.Net

Regards
Sachin
Reply to this message...
 
    
Das
Read my article at
http://aspalliance.com/das/tutorial/email.aspx

which talks about

a.. What we need to send Email from an ASP .NET?
a.. How to send an email from an ASP .NET page?
a.. What is new in sending email? (SmtpMail.SmtpServer)
a.. How can we send attachments in an email?

:-)
Das.

----- Original Message -----
From: "Sachin Mhatre" <Click here to reveal e-mail address>
To: "ngfx-mail" <Click here to reveal e-mail address>
Sent: Friday, April 26, 2002 5:34 AM
Subject: [ngfx-mail] Mail

> -- Moved from [aspngfreeforall] to [ngfx-mail] by Douglas Reilly
<Click here to reveal e-mail address> --
[Original message clipped]

Reply to this message...
 
    
Mark Runyon
Can anybody give me good example of sending a mail through ASP.Net

Regards
Sachin
Reply to this message...
 
    
Gfw
Can anybody give me good example of sending a mail through ASP.Net

Regards
Sachin
Reply to this message...
 
    
Carlos Magalhaes
-- Moved from [aspngfreeforall] to [ngfx-mail] by Dana Coffey <Click here to reveal e-mail address> --

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE>Mail</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi all , </FONT>
</P>

<P><FONT SIZE=3D2>I read a very interesting article that explains how =
to use the mail object in .NET (<A =
HREF=3D"http://www.dotnetbips.com/displayarticle.aspx?id=3D87"" target="_blank">http://www.dotnetbips.com/displayarticle.aspx?id=3D87"; =
TARGET=3D"_blank">http://www.dotnetbips.com/displayarticle.aspx?id=3D87<=
/A>)</FONT></P>
<BR>

<P><FONT SIZE=3D2>Now I have a few questions that I would like to =
ask.</FONT>
</P>

<P><FONT SIZE=3D2>Here is a code snippet from the article</FONT>
</P>

<P><FONT =
SIZE=3D2>>>>>>>>>>>>>>>>>=
;>START =
CODE<<<<<<<<<<<<<<<<<=
<<<</FONT>
<BR><FONT SIZE=3D2>Dim mm As New MailMessage()</FONT>
<BR><FONT SIZE=3D2>mm.From =3D "Click here to reveal e-mail address"</FONT>
<BR><FONT SIZE=3D2>mm.To =3D "Click here to reveal e-mail address"</FONT>
<BR><FONT SIZE=3D2>mm.Subject =3D "This is subject"</FONT>
<BR><FONT SIZE=3D2>mm.Body =3D "This is message"</FONT>
<BR><FONT SIZE=3D2>Dim ma as New =
MailAttachment("c:\attatchments\somefile.zip")</FONT>
<BR><FONT SIZE=3D2>mm.Attachments.Add(ma)</FONT>
<BR><FONT SIZE=3D2>SmtpMail.Send(mm)</FONT>
<BR><FONT =
SIZE=3D2>>>>>>>>>>>>>>>>END=
=
CODE<<<<<<<<<<<<<<<<<=
<<<<<<</FONT>
</P>

<P><FONT SIZE=3D2>Question One:</FONT>
</P>

<P><FONT SIZE=3D2>You have a From , to subject Body , and one can have =
a cc and bcc as well.</FONT>
</P>

<P><FONT SIZE=3D2>Now here there is a variable declared as mm (New Mail =
Message)</FONT>
<BR><FONT SIZE=3D2>Ok so the :</FONT>
<BR><FONT SIZE=3D2>mm.From </FONT>
<BR><FONT SIZE=3D2>mm.To  </FONT>
<BR><FONT SIZE=3D2>mm.Subject </FONT>
<BR><FONT SIZE=3D2>mm.Body</FONT>
</P>

<P><FONT SIZE=3D2>Are all properties of the mail object =
(correct?)</FONT>
</P>

<P><FONT SIZE=3D2>Can one create and application where one would use =
lets say a text box for input for all these values and store the input =
in a variable and then pass it to the properties instead of =
specifying/hard coding it like the example above?</FONT></P>

<P><FONT SIZE=3D2>E.g </FONT>
</P>

<P><FONT SIZE=3D2>Have textbox name =3D "From"</FONT>
</P>

<P><FONT SIZE=3D2>Then Dim strfrom as string </FONT>
<BR><FONT SIZE=3D2>strfrom =3D From.text</FONT>
</P>

<P><FONT SIZE=3D2>Then setting </FONT>
<BR><FONT SIZE=3D2>mm.From =3D "From"</FONT>
</P>

<P><FONT SIZE=3D2>What I am trying to get at is if the user input in =
the text box Click here to reveal e-mail address that can be passed to the mm.from =
property?</FONT>
</P>

<P><FONT SIZE=3D2>And I can use the same for all the rest of the =
properties.</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Now Question Two.</FONT>
</P>

<P><FONT SIZE=3D2>Now the interesting part the attachment.</FONT>
</P>

<P><FONT SIZE=3D2>Im trying to have/build the same functionality as =
Hotmail where one can choose the attachment from your machine/location =
and the send it via hotmail (scanned and all) how could I do =
that.</FONT></P>

<P><FONT SIZE=3D2>Would I simply just store the location of the file =
specified by the user as a variable pass it to the Attachments.Add =
prperty </FONT></P>

<P><FONT SIZE=3D2>Some thing like this </FONT>
</P>

<P><FONT SIZE=3D2>Textbox Attachments name =3D =
"attach"</FONT>
<BR><FONT SIZE=3D2>Dim attachment as String </FONT>
<BR><FONT SIZE=3D2>Attachment =3D Attach.text</FONT>
<BR><FONT SIZE=3D2>Dim ma as New =
MailAttachment("Attachment")</FONT>
<BR><FONT SIZE=3D2>mm.Attachments.Add(ma)</FONT>
</P>

<P><FONT SIZE=3D2>Would that also work.</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Can have some views help criticism code etc where =
some one can help me here before I start coding away the incorrect way!<=
/FONT></P>

<P><FONT SIZE=3D2>Thank you </FONT>
</P>

<P><FONT SIZE=3D2>Carlos</FONT>
</P>

</BODY>
</HTML>

-------------------------------------------------------------
This email and any files transmitted are
confidential and intended solely for the
use of the individual or entity to which
they are addressed, whose privacy
should be respected. Any views or
opinions are solely those of the author
and do not necessarily represent those
of the Trencor Group, or any of its
representatives, unless specifically
stated.

Email transmission cannot be guaranteed
to be secure, error free or without virus
contamination. The sender therefore
accepts no liability for any errors or
omissions in the contents of this message,
nor for any virus infection that might result
from opening this message. Trencor is not
responsible in the event of any third party
interception of this email.

If you have received this email in error please notify
Click here to reveal e-mail address For more information about
Trencor, visit www.trencor.net <http://www.trencor.net>

Reply to this message...
 
 
System.Web.Mail.MailAttachment
System.Web.Mail.MailMessage
System.Web.Mail.SmtpMail




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification