The problem is that all rthe messages I send are delivered to Queue directory from Inetpub directory.
What should I do to make it work? I mean to make it send the message to "mydomain@dotnet.itags.org.yahoo.com"?
Thsi is the code on page:
<%@dotnet.itags.org. Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@dotnet.itags.org. Import Namespace="System.Web.Mail.MailMessage" %>
<%@dotnet.itags.org. Import Namespace="System.Web.Mail.SmtpMail" %
<html>
<script runat="server" language="VB">
Sub Send(Sender as Object, e as EventArgs)
Dim mailMessage As System.Web.Mail.MailMessagemailMessage = New System.Web.Mail.MailMessage
mailMessage.From = "Support@dotnet.itags.org.myserver.com"
mailMessage.To = "mydomain@dotnet.itags.org.yahoo.com"
mailMessage.Subject = "Test subject"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
mailMessage.Body = "Testing email "
System.Web.Mail.SmtpMail.SmtpServer = "localhost"
Try
System.Web.Mail.SmtpMail.Send(mailMessage)
Label1.Text = "Message sent!"
Catch ex As Exception
Label1.Text = ex.Message
End Try
end sub
</script>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form runat="server">
<p>
<asp:button runat="server" Text="Send email" OnClick="Send" />
</p>
<p>
<asp:label ID="Label1" runat="server"></asp:label>
</p>
</form>
</body>
</html>
Thanks Dan.
<%@. Page Language="VB"%>
<%@. Import Namespace="System.Web.Mail" %
<script runat="server"
Sub Send(Sender as Object, e as EventArgs)Dim objEmail As New MailMessage()
objEmail.From = tbSender.text
objEmail.To = "mydomain@.yahoo.com"
objEmail.Subject = "Test subject"
objEmail.BodyFormat = MailFormat.text
objEmail.Body = tbComment.textSmtpServer.SmtpServer = "yourservername"
'supply in the name of your smtpserver above
SmtpServer.Send(objEmail)end sub
</script
<body
<form runat="server"
<asp:textbox id="tbSender" runat="server"/><br>
<asp:textbox id="tbComment" multiline="true" runat="server"/><br>
<asp:button runat="server" Text="Send email" OnClick="Send" /
</form
</body
</html>
It still doesn't work. I still get the message in the Queue folder.
I replaced the "yourservername" with "localhost" and it is the same thing I did before.
I'm running my web site from my PC and I would like to be able to send and receive mail through my page. Why the message i'm sending goes to Queue folder instead to the "myemail@.yahoo.com" address?
What other things I have to setup to make it work?
I GOT IT!!!!!
It works if instead of your "System.Web.Mail.SmtpMail.SmtpServer = "localhost" you put your ISP name it works like this
System.Web.Mail.SmtpMail.SmtpServer = "Earthlink.net"
Thanks anyway for your help!
You need to find the name of your remote smtp server. Then place it in SmtpServer.SmtpServer = " "
Anyway glad you go it working.
0 comments:
Post a Comment