Navigation

Simple email example

 

using System;
using System.Net;
using System.Web.Mail;
class SimpleEmail
{
public static void Main()
{
string from = "youremail@email.com";
string to = "myemail@email.com";
string subject = "This is the subject line";
string body = "This is the body of the message";
SmtpMail.SmtpServer = "smtp.myemail.com";
SmtpMail.Send(from, to, subject, body);
}
}

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. Email example <%@Page Explicit="False" Language="VB" Debug="True" %> <%@Import Namespace="System.Web.Mail" %> <% Dim...
  2. Sending an HTML email <% Dim objCdonts , strHTML Set objCdonts = Server.CreateObject(“CDONTS.NewMail”) ‘now...
  3. Send an email <% ‘declare our variables Dim strMessage , objCDO Set objCDO...
  4. Email function <% Function SendMail(mTo , mFrom , mSubject , mBody) Set...
  5. Sending an e-mail attachment <% Dim objCDONTS ‘create an instance of the object Set...

Related posts brought to you by Yet Another Related Posts Plugin.

You must be logged in to post a comment.