Jump to content

Recommended Posts

Posted

I have made a contact form on a web-site, where one of the fields to fill out is the senders e-mail adress.

When I try sending a mail to my self on a hotmail acount, the Hotmail always puts the email on the Junk E-mail folder. It stands that the sender-Id cannot be controlled..

This is the code that I use..

<%@ Import Namespace="System.Web.Mail" %>

<script runat="Server">
Sub Button_Click( s As Object, e As EventArgs )
SmtpMail.Send( _
mailfrom.Text, _
mailto.Text, _
mailsubject.Text, _
mailbody.Text )
End Sub
</Script>

<html>
<head><title>SendMail.aspx</title></head>
<body>

<h1>Send Mail:</h1>
<form runat="Server">

<b>From:</b>
<br>
<asp:TextBox
ID="mailfrom"
Columns="50"
Runat="Server" />
<p>
<b>To:</b>
<br>
<asp:TextBox
ID="mailto"
Columns="50"
Runat="Server" />
<p>
<b>Subject:</b>
<br>
<asp:TextBox
ID="mailsubject"
Columns="50"
Runat="Server" />
<p>
<b>Body:</b>
<br>
<asp:TextBox
ID="mailbody"
TextMode="Multiline"
Columns="50"
Rows="10"
Runat="Server" />
<p>
<asp:Button
Text="Send!"
OnClick="Button_Click"
Runat="Server" />
</form>

</body>
</html>

  • 3 months later...

Posted

I do not think the problem is in your code, as you said the mail is delivered at hotmail, so technicaly its working ;-)

It is more likely your mail is seen as 'potential spam' because the sender address (domain name eg microsoft.com) is not the same address your mailserver ( servername = mywebsite.com).

To circumvent having your mail end up in the spamfilters configure script to send the mail with a mail address that does reside on your own webserver.

You need to be carefull with scripts like these though, people may abuse them to send spam and if that happens you may get blacklisted. The best use for scripts like these in my opinion is to only send mail from the form to your own address.

:)

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...