Hi i have a problem in mailing in the C#.net. I want to mail to the email address but i do not want to open the Outlook. Is there any procedure to do this. Please help to mail in c#.net.
Sounds like your putting a mailto:...
link on your form. This will always open the default mail client on the user's PC.
What you need to do is have a contact form and send the email via the server.
For more information see the following website:
System.Net.Mail
How do I send a plain text email? (System.Net.Mail)
For reference:
You will need access to an SMTP server. If you have that add the following to your web.config:
<system.net>
<mailSettings>
<smtp>
<network
host="relayServerHostname"
port="portNumber"
userName="username"
password="password" />
</smtp>
</mailSettings>
</system.net>
And take a look at .NET's MailMessage class. here is an example of how to craete a basic MailMesage object:
MailMessage message = new MailMessage(
"[email protected]",
"[email protected]",
"Quarterly data report.",
"See the attached spreadsheet.");
To send the message you will use the SmtpClient class (which is conviniently configured from your web.config if you added the xml i suggested above. Example:
SmtpClient client = new SmtpClient();
client.Send(message);
Hey,
The System.Net.Mail namespace was meant to do this; check this out: http://www.systemnetmail.com/