UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server and VPS Forum > Technical Support > Windows Shared Hosting

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 21-11-2008, 16:06
new member
 
Join Date: Nov 2008
Posts: 3
Exclamation ASP.NET problem sending emails with custom to address

hi,

I'm in the process of creating my own ASP.NET mailing list. I'm using the following code to send emails:

public static void Send(string to, string from, string subject, string message)
{
MailMessage email = new MailMessage(to, from, subject, message);
email.IsBodyHtml = true;

(new SmtpClient()).Send(email);
}

The problem is is that an exception gets thrown if I send an email to an address that hasn't already been setup in the eukhost control panel. PLEASE don't tell me that I will have to individually create a different account per recepitent in the database?!

I'm assuming I have in someway not configured the above code correctly?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 21-11-2008, 16:52
new member
 
Join Date: Nov 2008
Posts: 8
Default ASP.NET problem sending emails with custom to address

Hello Stevell,

Can you make sure that the SMTP server name you are using is localhost . Also if you still face problem please provide us with the exact URL which throws execption .

Regards,

Paulwin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 21-11-2008, 17:44
new member
 
Join Date: Nov 2008
Posts: 3
Default

Can you tell me why that would help? I'm assuming its so that you can see the execption?

I have some more details after trying configuring it with localhost.

The code used to send the email:

MailMessage email = new MailMessage(to, from, subject, message);
email.IsBodyHtml = true;
SmtpClient cl = new SmtpClient();
cl.Host = "localhost";
cl.Send(email);

Also I have some other configuration in my web.config i found:

<system.net>
<mailSettings>
<smtp>
<network host="localhost" password='****' userName='*******' />
</smtp>
</mailSettings>
</system.net>

And lastly here is the ASP.NET exception I get:

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.Mail.SmtpException: User not local; please try a different path. The server response was: Sender address is not valid for your login. Check your email program settings. at System.Net.Mail.MailCommand.CheckResponse(SmtpStat usCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at SJL.SJLPhotographic.Utils.AbstractEmailSender.Send (String to, String from, String subject, String message) in d:\inetpub\vhosts\sjlphotographic.com\httpdocs\App _Code\Utils\AbstractEmailSender.cs:line 14 at SJL.SJLPhotographic.Utils.AdminEmailSender.Send(St ring to, String subject, String message) in d:\inetpub\vhosts\sjlphotographic.com\httpdocs\App _Code\Utils\AdminEmailSender.cs:line 19 at About.Page_Load(Object sender, EventArgs e) in D:\inetpub\vhosts\sjlphotographic.com\httpdocs\Abo ut.aspx.vb:line 8 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.about_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e() at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 21-11-2008, 18:04
eUK-Martin's Avatar
Windows System Administrator
 
Join Date: Nov 2005
Location: Earth
Posts: 537
Default

"localhost" would have helped as the server is sure that the domain that is using the mail server is a local address.

For the error that you receive, I would suggest you to make sure that the From: email address used in the script to send email is a valid and local email address. Also you will not be able to send emails if you authenticate with the email 'info@domain_name' and specify From: address as 'sales@another_domain'.
__________________
Martin
Windows Dept.

Windows 100% Uptime Hosting - Windows Dedicated Server - Web Hosting Tutorials
__________________________________________________ _______
MyWebHostingBlog - About ASP .NET, MS SQL & Windows Dedicated Hosting Services.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 21-11-2008, 19:29
new member
 
Join Date: Nov 2008
Posts: 3
Default

Quote:
Originally Posted by eUK-Martin View Post
"localhost" would have helped as the server is sure that the domain that is using the mail server is a local address.

For the error that you receive, I would suggest you to make sure that the From: email address used in the script to send email is a valid and local email address. Also you will not be able to send emails if you authenticate with the email 'info@domain_name' and specify From: address as 'sales@another_domain'.
Just to re-clarify my original question. I already know how to (and can) send emails using a registered local email address in the to and from fields. However in the process of creating a mailing list I want to use a local from address and a non local to address. That is where the problem lies.

So, is it not possible? Or is there some different smtp configuration I need to use?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 22-11-2008, 10:02
eUK-Martin's Avatar
Windows System Administrator
 
Join Date: Nov 2005
Location: Earth
Posts: 537
Default

Quote:
Originally Posted by stevell View Post
Just to re-clarify my original question. I already know how to (and can) send emails using a registered local email address in the to and from fields. However in the process of creating a mailing list I want to use a local from address and a non local to address. That is where the problem lies.

So, is it not possible? Or is there some different smtp configuration I need to use?
Yes, this is very much possible. I would suggest you to set the email server as localhost with no authentication. And you if you still face any problem then please email us on windows [at] eukhost.com with the link where you get the errors and we will have a look at the email script.
__________________
Martin
Windows Dept.

Windows 100% Uptime Hosting - Windows Dedicated Server - Web Hosting Tutorials
__________________________________________________ _______
MyWebHostingBlog - About ASP .NET, MS SQL & Windows Dedicated Hosting Services.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT. The time now is 03:13.

 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0

 
Site Map

VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

Business Web Hosting
100% uptime Hosting

Cpanel Hosting
cPanel Shared Hosting

Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

ColdFusion Hosting
ColdFusion Web Hosting


knowledgebase articles

eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting

Joomla Hosting
Joomla Web Hosting

Mambo Hosting
Mambo Web Hosting

Magento Hosting
Magento Web Hosting

Wordpress Hosting
Wordpress Web Hosting


popular blog categories


Web Hosting
Website Hosting articles

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles

Web Hosting
Web Hosting Service