Solution :
Please note that if you are using form mail coding in your website you have to create the authentication mail id in our server.
Please refer the below information which will be needed in a form mail coding.
SMTP host name : mail.domainname or Serverip
Incoming mail server : Serverip
Outgoing mail server : Serverip
SMTP : 25
POP3 : 110
ASP Form mail coding :
mail.asp :
<%
Dim iMsg, iConf, Flds, vSub
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'sending email with Google Apps Premium SMTP server (with autentication)
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "smtpserver") = "SERVER IP"
Flds.Item(schema & "smtpserverport") = 25
Flds.Item(schema & "sendusername") = "test- emailid"
Flds.Item(schema & "sendpassword") = "Password"
Flds.Update
With iMsg
.To = "test@yourdomainname.com"
.From = "contact@yourdomainname.com"
.Subject = "Reservation"
.TextBody = "Mail Sent"
Set .Configuration = iConf
.Send
End With
response.Write "Successfully Sent"
set iMsg = nothing
set iConf = nothing
set Flds = nothing
%>
ASP.NET Form mail coding :
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
Email ID:<asp:TextBox ID="TextBox1" runat="server" Width="412px"></asp:TextBox>
<br />
<br />
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send Mail" />
</div>
</form>
</body>
</html>
Default.aspx.cs:
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(TextBox1.Text);
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
message.From = new System.Net.Mail.MailAddress("test@yourdomainname.com", "password");
message.Bcc.Add("test@yourdomainname.com");
message.Subject = "Test Mail";
message.Body = "Test";
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Host = "ServerIP";
client.Port = 25;
string userName = "test@yourdomainname.com";
string password = "Password";
client.Credentials = new NetworkCredential(userName, password);
client.Send(message);
lblMessage.Text = "Mail send Successfully";
}
catch (Exception ex) { lblMessage.Text = ex.Message; }
}
}
PHP Form mail coding :
Contact.html
<html><body><font face=Arial size=2>
<form method="post" action="contact.php">
<table bgcolor=#ffffcc align=center>
<tr><td colspan=2><strong>Contact us using this form:</strong></td></tr>
<tr><td>Department:</td><td><select name="sendto"> <option value="test@yourdomainname.com">General</option>
<tr><td><font color=red>*</font> Name:</td><td><input size=25 name="Name"></td></tr>
<tr><td><font color=red>*</font> Email:</td><td><input size=25 name="Email"></td></tr>
<tr><td>Company:</td><td><input size=25 name="Company"></td></tr>
<tr><td>Phone:</td><td><input size=25 name="Phone"></td></tr>
<tr><td>Subscribe to<br> mailing list:</td><td><input type="radio" name="list" value="No"> No Thanks<br> <input type="radio" name="list" value="Yes" checked> Yes,
keep me informed<br></td></tr>
<tr><td colspan=2>Message:</td></tr>
<tr><td colspan=2 align=center><textarea name="Message" rows=5 cols=35></textarea></td></tr>
<tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
<tr><td colspan=2 align=center><small>A <font color=red>*</font> indicates a field is required</small></td></tr>
</table>
</form>
</body>
</html>
contact.php
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Web Contact Data";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Company"} = "Company";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"list"} = "Mailing List";
$fields{"Message"} = "Message";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: test@yourdomainname.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our
website at www.oursite.com";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.yourdomainname.com/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; }
}
}
?>