This problem occurs because read access to the Internet Information Services (IIS) metabase and the Microsoft Active Directory directory service has been removed for the Everyone group. This access has been removed because of a security modification in Exchange 2000 Server SP3. CDOEX, CDOSYS, and System.Web.Mail must have access to the IIS metabase to access information about the location of the pickup directory path. This behavior occurs when you use the Sendusingpickup method and if this information is not specified in the application code. Because access is restricted, the non-administrative user under whose security context the application is running cannot read this information from the IIS metabase and Active Directory.
For more information refer Read Access to the Everyone Group Is Removed After You Install Exchange 2000 SP3
Here is an article from ftp online: Transfer Files Over the Internet
PermalinkHere is an article from ftp online: Easy E-Mail-It’s About Time
PermalinkThis is happening because your SmtpMail.SmtpServer is rejecting addresses.
To resolve this make sure
- all email addresses specified at MailMessage.To, MailMessage.Cc, MailMessage.Bcc and MailMessage.From are valid email addresses
- you have permissions to relay through the server.
- MailMessage.From has permissions to relay through the server
Seperate each recipient with a semicolon (;) in the mailMessage.To property:
VB.NET
mailMessage.To = 'abc@syncfusion.com;xyz@syncfusion.com'
C#
mailMessage.To = 'abc@syncfusion.com;xyz@syncfusion.com';
PermalinkThis is a network related error. Your application cannot connect to the mail server specified.
Make sure that the following are true about SmtpMail.SmtpServer:
- Is a valid SMTP Server
- Make sure that the server System.Web.Mail is running or can connect to the mail server. Some times firewalls or proxy servers can get in the way.
- Try specifying the value by IP address. Poor DNS resolution can sometimes hinder name lookups.
- Make sure that the mail server is running at port 25.
- If you did not specify a SmtpMail.SmtpServer property, or if SmtpMail.SmtpServer points to ‘localhost’ (or the equivalent), be sure the SMTP Service is running on port 25.
- For testing purposes change the MailMessage.From and MailMessage.To properties to an address that exists on SmtpMail.SmtpServer. Some times this exception is thrown, when it really is a relay issue.
VB.NET
Dim mailattach As New MailAttachment(Server.MapPath('<yourfilename>'))
mail.Attachments.Add(mailattach)
C#
MailAttachment mailattach = new MailAttachment( Server.MapPath( '<yourfilename>' ) );
mail.Attachments.Add( mailattach );
PermalinkFormat the email address this way:
VB.NET
mail.From = 'Name <name@syncfusion.com>'
mail.To = 'Name <name@syncfusion.com>'
C#
mail.From = 'Name <name@syncfusion.com>';
mail.To = 'Name <name@syncfusion.com>';
PermalinkThe SMTP server is not configured to allow you to relay. If you are working with a local SMTP server, you can configure it to allow relaying for IP 127.0.0.1.
PermalinkRefer Read POP3 Email with ASP.NET
PermalinkInstall the SMTP virtual server that is part of IIS.
- You will need your Windows installation CD.
- Use Add or Remove Programs in the Windows Control Panel to launch Add/Remove Windows Components.
- Select Internet Information Services (IIS) and then click Details.
- Check SMTP Service and then click OK.
- The installation process will prompt you for your Windows CD and will install the SMTP virtual server.
After installing the SMTP server (also reboot), configure it by following these steps:
-
In the Control Panel, choose Administrative Tools, and then choose Internet Information Services.
-
Open the node for your computer, right-click the Default SMTP Virtual Server node and choose Properties.
-
In the Access tab, click Connection.
-
Select Only the list below, click Add and add the IP 127.0.0.1. This restricts connections to just the local computer, i.e., localhost. Close the Connection dialog box.
-
Click Relay and repeat Step 5 to allow only localhost to relay through this server.
In your firewall or router (or both), close incoming port 25. This is an important security measure that will prevent spammers from finding your SMTP server and using it to relay spam.
Use System.Web.Mail
The System.Web.Mail namespace contains classes that enable you to construct and send messages using the CDOSYS (Collaboration Data Objects for Windows 2000) message component. The mail message is delivered either through the SMTP mail service built into Microsoft Windows 2000 or through an arbitrary SMTP server. The classes in this namespace can be used from ASP.NET or from any managed application.
For more details refer System.Web.Mail Namespace
PermalinkVB.NET
Protected Sub Application_Error(sender As [Object], e As EventArgs)
Dim ex As Exception = Server.GetLastError()
Dim mail As New MailMessage()
mail.To = 'manag@syncfusion.com'
mail.From = 'admin@syncfusion.com'
mail.Subject = ex.Message.ToString()
mail.Body = ex.ToString()
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = 'localhost'
SmtpMail.Send(mail)
End Sub ’Application_Error
C#
protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError ();
MailMessage mail = new MailMessage();
mail.To = 'manag@syncfusion.com';
mail.From = 'admin@syncfusion.com';
mail.Subject = ex.Message.ToString ();
mail.Body =ex.ToString ();
mail.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = 'localhost';
SmtpMail.Send( mail );
}
PermalinkVB.NET
mail.BodyEncoding = System.Text.Encoding.GetEncoding( 'ISO-2022-JP' )
C#
mail.BodyEncoding = System.Text.Encoding.GetEncoding( 'ISO-2022-JP' );
PermalinkUse namespace System.IO and System.NET
VB.NET
’In Page_Load
Dim mailcontenturl As String = 'http://www.syncfusion.com'
Dim mail As New MailMessage()
mail.To = 'manag@syncfusion.com'
mail.From = 'admin@syncfusion.com'
mail.Subject = 'Test.'
’To send webpage
mail.Body = GetHTML(mailcontenturl)
mail.BodyFormat = MailFormat.Html
mail.UrlContentBase = mailcontenturl
SmtpMail.SmtpServer = 'localhost'
SmtpMail.Send(mail)
’Function GetHTML
Private Function GetHTML(url As String) As String
Dim wReq As WebRequest = System.Net.HttpWebRequest.Create(url)
Dim sr As New StreamReader(wReq.GetResponse().GetResponseStream())
Dim result As String = sr.ReadToEnd()
sr.Close()
Return result
End Function ’GetHTML
C#
//In Page_Load
string mailcontenturl ='http://www.syncfusion.com';
MailMessage mail = new MailMessage();
mail.To = 'manag@syncfusion.com';
mail.From = 'admin@syncfusion.com';
mail.Subject = 'Test.';
//To send webpage
mail.Body = GetHTML ( mailcontenturl );
mail.BodyFormat = MailFormat.Html;
mail.UrlContentBase = mailcontenturl;
SmtpMail.SmtpServer = 'localhost';
SmtpMail.Send( mail );
//Function GetHTML
private string GetHTML( string url )
{
WebRequest wReq= System.Net.HttpWebRequest.Create(url);
StreamReader sr = new StreamReader( wReq.GetResponse().GetResponseStream() );
string result = sr.ReadToEnd();
sr.Close();
return result;
}
PermalinkVB.NET
Dim mail As New MailMessage()
mail.To = 'manag@syncfusion.com'
mail.From = 'admin@syncfusion.com'
mail.Subject = 'Test.'
mail.BodyFormat = MailFormat.Html
mail.Body = 'Test Message'
SmtpMail.SmtpServer = 'localhost' ’your real server goes here
SmtpMail.Send(mail)
C#
MailMessage mail = new MailMessage();
mail.To = 'manag@syncfusion.com';
mail.From = 'admin@syncfusion.com';
mail.Subject = 'Test.';
mail.BodyFormat = MailFormat.Html;
mail.Body = 'Test Message';
SmtpMail.SmtpServer = 'localhost'; //your real server goes here
SmtpMail.Send( mail );
PermalinkVB.NET
Dim mail As New MailMessage()
mail.To = 'admin@syncfusion.com'
mail.From = 'manag@syncfusion.com'
mail.Subject = 'Test.'
mail.Body = 'Test Message'
SmtpMail.SmtpServer = 'localhost' ’your real server goes here
SmtpMail.Send(mail)
C#
MailMessage mail = new MailMessage();
mail.To = 'admin@syncfusion.com';
mail.From = 'manag@syncfusion.com';
mail.Subject = 'Test.';
mail.Body = 'Test Message';
SmtpMail.SmtpServer = 'localhost'; //your real server goes here
SmtpMail.Send( mail );
PermalinkVB.NET
mail.Headers.Add( 'Reply-To', 'admin1@syncfusion.com' )
C#
mail.Headers.Add( 'Reply-To', 'admin1@syncfusion.com' );
PermalinkCDOSYS supports username and password authentication, and version 1.1 of the .NET Framework added the Fields property to the MailMessage class, which lets you set arbitrary fields of the underlying CDOSYS object.
Refer Extending System.Web.Mail
Permalink
Share with