473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net direct mailing

can i directly mail to hotmail or yahoo acount with any asp.net code.
i have an example like above but i need smtp adress for hotmail,
i tried it for smtp.mail.yahoo.com but it didnt work and "authentication
required" error accured

here is the code:
<%@ Page Language="VB" ContentType="text/html" debug="true"
ResponseEncoding="iso-8859-1" %>
<%@Import Namespace="System.Web.Mail" %>
<script language="VBScript" runat="server">
' compile and send the email message
sub SendEmail(sender as Object, e As EventArgs)
' This script is the property of D2 Computing, please do not redistribute it
' Check www.d2computing.co.uk for more scripts
' *************************************************
' IMPORTANT - CHANGE THE TWO VARIABLES BELOW TO YOUR OWN EMAIL ADDRESS AND
SMTP SERVER ADDRESS
' *************************************************
' CHANGE THE BELOW TO THE ADDRESS YOU WISH THE EMAIL TO BE SENT TO
dim sendmessageto as string = "a@hotmail.com"
' CHANGE THE BELOW TO YOUR SMTP SERVER ADDRESS, NORMALLY YOUR ISP'S SMTP
SERVER
dim smtpservername as string = "smtp.mail.hotmail.com"
dim HTMLmessage as string
HTMLmessage = "<html>"
HTMLmessage = HTMLmessage & "<head>"
HTMLmessage = HTMLmessage & "<meta http-equiv=""Content-Type"""
HTMLmessage = HTMLmessage & "content=""text/html; charset=iso-8859-1"">"
HTMLmessage = HTMLmessage & "<title>Mail from website contact</title>"
HTMLmessage = HTMLmessage & "</head>"
HTMLmessage = HTMLmessage & "<body bgcolor=""edefea"">"
HTMLmessage = HTMLmessage & "<font color=#000000 size=2 face=Verdana>"
HTMLmessage = HTMLmessage & "<b>Message sent from website contact
form:</b>"
HTMLmessage = HTMLmessage & "<p></p>"
HTMLmessage = HTMLmessage & "<b>Message from:</b" & TxtUserName.Text
HTMLmessage = HTMLmessage & "<p></p>"
HTMLmessage = HTMLmessage & "<b>Users email:</b" & TxtUserEmail.Text
HTMLmessage = HTMLmessage & "<p></p>"
HTMLmessage = HTMLmessage & "<b>Message text:</b" & TxtComment.Text
HTMLmessage = HTMLmessage & "<p></p>"
HTMLmessage = HTMLmessage & "<b>Date/Time:</b" & now()
HTMLmessage = HTMLmessage & "<p></p>"
HTMLmessage = HTMLmessage & "<b>Users IP address:</b" &
Request.ServerVariables("REMOTE_ADDR")
HTMLmessage = HTMLmessage & "<p></p>"
HTMLmessage = HTMLmessage & "<b>****** END OF MESSAGE ******</b>"
HTMLmessage = HTMLmessage & "</font></body>"
HTMLmessage = HTMLmessage & "</html>"

Dim TheMessage as new Mailmessage
With TheMessage
..To = sendmessageto
..From = TxtUserEmail.Text
..Body = HTMLmessage
..Subject = "Message from D2 Computing web contact form"
..BodyFormat = MailFormat.Html
End With
SmtpMail.SmtpServer = smtpservername
Smtpmail.Send(TheMessage)
TxtComment.Enabled = "False"
TxtUserName.Enabled = "False"
TxtUserEmail.Enabled = "False"
TxtComment.Text = "***** Message Sent OK ***** Please follow the link below
to return to the main page"
TxtUserName.Text = "***** Message Sent OK *****"
TxtUserEmail.Text = "***** Message Sent OK *****"
BtnSendMail.Enabled = "False"
BtnSendMail.Text = "Message Sent !"
LblMailSent.visible = "True"
TheMessage = Nothing
end sub
</script>


<html>
<head>
<title>Contact us</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="dotnetcontact.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="fmcontact" runat="server">
<p align="center"><img src="images/anonco.gif" width="371" height="74"></p>
<table width="550" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="186">Your Name:</td>
<td width="350"><asp:textbox AutoPostBack="false" ID="TxtUserName"
runat="server" TextMode="SingleLine" Width="250"/>
<asp:RequiredFieldValidator ID="ValUsername" runat="server"
ErrorMessage="Please supply your name."
ControlToValidate="TxtUserName" Text="*
Required"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Your Email Address:</td>
<td><asp:textbox AutoPostBack="false" ID="TxtUserEmail"
runat="server" TextMode="SingleLine" Width="250"/>
<asp:RequiredFieldValidator ID="ValUserEmail" runat="server"
ErrorMessage="Please supply your email address."
ControlToValidate="TxtUserEmail" Text="*
Required"></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID="ValValidEmail" runat="server"
ValidationExpression="^[\w\-\.']+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*?\.[a-zA-Z]{2,4}$"
ErrorMessage="The email address must be a valid internet email address."
ControlToValidate="TxtUserEmail" Text="*
Valid?"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>Question/Comment:</td>
<td><asp:textbox AutoPostBack="false" ID="TxtComment" Rows="9"
runat="server" TextMode="MultiLine" Width="250" />
<asp:RequiredFieldValidator ID="ValUserComment" runat="server"
ErrorMessage="Please supply a question/comment."
ControlToValidate="TxtComment" Text="*
Required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td</td>
<td><asp:ValidationSummary
ID="valSum"
DisplayMode="BulletList"
runat="server"
HeaderText="Please check the following:"
Font-Name="verdana"
Font-Size="8"/>
</td>
</tr>
<tr>
<td colspan="2"><div align="center">
<asp:button ID="BtnSendMail" runat="server" Text="Send
Message" OnClick="SendEmail" />
</div></td>
</tr>
<tr>
<td colspan="2"><p align="center"><asp:label ID="LblMailSent"
runat="server" class="maillabel" Visible="False" Text="Your message was sent
sucessfully, click <a href=index.asp>here</ato
return to the main page" /></p></td>
</tr>
</table>
<div align="center"></div>
</form>
</body>
</html>

Aug 27 '06 #1
0 1286

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

Similar topics

4
4799
by: Thom McGrath | last post by:
I'm writing a simple mailing list program, and I would like to know what the suggested method of sending a large number of emails to a list of addresses. (sounds like spam, no?) It's perfectly...
1
2303
by: Amit | last post by:
I have created formatted-PDF in Buffer. This PDF document have many images, lines, texts with underline-bold-italic. I put this buffer PDF contents to a variable. When I try to send the variable...
3
1936
by: Dave Moore | last post by:
Hi All, Is it possible to implement a mailing list using PHP?. I know I could maintain a list of emails addresses in a db and send mail to them through my website, but how can I get true mailing...
0
6359
by: Brian van den Broek | last post by:
Hi all, There have been a few posts over the last month or so expressing a bit of exasperation with the "rising tide of newbie's". (Or, more accurately, the rising tide of questions from...
3
2320
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
4
2652
by: kerb | last post by:
Hello can you help I am trying to access direct address in ufs filesystem what I am trying to do is for example I have inode 12930123912 and I want to know where on which CHS (cylinder,head...
2
13481
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
4
2527
by: Andy M | last post by:
ALERT There is a person by the name of Mike Cox who's trying to turn this mailing list into a Big-8 newsgroup. Many of you know that this and most of the other postresql mailing lists are...
3
2011
by: razjafry | last post by:
Hi Experts, I have two tables - tblContact and tblOrg Contact table has only one option of mailing address e.g address,city,postal code whereas Org table has two options - one simple address -...
13
1783
by: Beauregard T. Shagnasty | last post by:
My shared web host has made some sort of upgrade to .. something .. the support tech can't tell me what. It's a cPanel system, with all the regular stuff. The site is a club site. For years, I...
0
7231
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
7336
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
7405
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
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.