Sponsored by
www.aspnetemail.com
|
 |
Discuss This FAQ Item
Got a question? Another Suggestion? Want to post your solution? Discuss it below.
-
What do I need to send email int .net
[ Reply ]
Can I send email in .net with any product of .NET (Architect, Developer or Professional)?
Can I gain access to any class of .NET FRAMEWORK with any product of .NET (Architect, Developer or Professional)?
Thank you.
Luis Enrique Gracia Prieto [ legracia ( at ) coferdroza dot es ],
2004-03-15 04:33:24
#
-
Relaying
[ Reply ]
How do I set up relaying?
Mathieu Diepman [ mathieu dot diepman ( at ) getronics dot com ],
2004-04-05 02:51:01
#
-
RE: Relaying
[ Reply ]
You can configure SMTP services and relay setting in your Default SMTP Virtual Server (found at IIS)
Default SMTP Virtual Server > Properties>General Here you can set your SMTP server address
Properties > Access Here you can add relay server address
For local machine the address is 127.0.0.1
Hope this helps,cheers
Cijo Ceazer [ cijo_ceazer ( at ) yahoo dot co dot in ],
2005-02-20 00:37:46
#
-
RE: Relaying
[ Reply ]
SEND ME A MESSAGE BACK.
PAUL FARRELL [ FARRELL dot PAUL ( at ) VIRGIN dot NET ],
2005-08-24 12:52:21
#
-
How to make command_bottom in VB.NET send Outlook Express email
[ Reply ]
I have problem...
In my VB.Net form1, INSIDE only have one TextBox1 for store email address & one Bottom1 for use transfer the “TextBox1” contents & create the new email in outlook express
Can someone tell me the sources how to make the bottom active for the above function.
Spencer mydream@pacific.net.hk
Spencer [ mydream ( at ) pacific dot net dot hk ],
2004-07-13 22:46:41
#
-
Code or CDOSYS.DLL Load
[ Reply ]
I am attempting to send mail using an external mail server. I have read plenty about the “.fields.add” addition to the SMTPmail class . I am using the code below and get an error in Visual Studio that “fields” is not a member of System.Web.Mail.MailMessage class.
I thought that perhaps the issue is that I do not have CDOsys.dll registered on my computer. When attempting to do so (register CDOsys.dll) I get a failure to register from RegSvr32.EXE application.
Do you believe that this is the problem or do you see any other issues in my code? I’m at a loss.
Imports System Imports System.Collections Imports System.Configuration Imports System.Data Imports System.Data.SqlClient Imports System.Security.Cryptography Imports System.Text Imports System.Text.RegularExpressions Imports System.Web.Mail Imports System.Web.Mail.SmtpMail Imports System.Web Imports System.Net
. . .
Public Function
SendMail(ByVal [From] As String, ByVal [To] As String, _ ByVal [Cc] As String, ByVal [Bcc] As String, ByVal [Priority] As Mail.MailPriority, _ ByVal [Subject] As String, ByVal [BodyFormat] As Mail.MailFormat, _ ByVal [BodyEncoding] As System.Text.Encoding, ByVal [Body] As String, _ ByVal [Attachment] As String) As String
Dim mail As New MailMessage()
mail.From = [From] mail.To = [To] mail.Priority = [Priority] mail.Subject = [Subject] mail.BodyFormat = [BodyFormat] mail.BodyEncoding = [BodyEncoding] mail.Body = [Body]
' external SMTP serve If SMTPServer <> "" Then SmtpMail.SmtpServer = SMTPServer Mail.Fields.add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 mail.Fields.add("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPUserName mail.Fields.add("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPassword
End If
Try SmtpMail.Send(mail) Catch objException As Exception LogError(objException) End Try
End Function
warren [ wsmay ( at ) newlineservices dot com ],
2005-03-01 14:58:49
#
-
RE: Code or CDOSYS.DLL Load
[ Reply ]
You are referencing the 1.0 .NET Framework. The .Fields property was introduced in the 1.1 Framework.
Cheers! Dave
dave wanta [ dave ( at ) 123aspx dot com ],
2005-03-01 15:01:23
#
-
RE RE: Code or CDOSYS.DLL Load
[ Reply ]
Thanks. I believe that I have downloaded/installed Framework 1.1 but maybe I havent. How & where do I look to determine that 1.1 is installed?
Warren
warren [ wsmay ( at ) newlineservices dot com ],
2005-03-03 05:33:27
#
-
RE: RE RE: Code or CDOSYS.DLL Load
[ Reply ]
C:\WINNT\Microsoft.NET\Framework
or
C:\Windows\Microsoft.NET\Framework
You can see all of the versions of .Net framework you have installed. It will have a seperate folder for each version.
Greg Conely [ gjconely ( at ) imagementor dot net ],
2005-05-27 11:57:21
#
-
Problems sending email
[ Reply ]
I'm writing a program to send an email internally. Here is the code I've got:
Dim Smtp As SmtpMail Smtp.SmtpServer = "mail.co.navajo.az.us" Dim Msg As MailMessage = New MailMessage Msg.To = "james.williams@co.navajo.az.us" Msg.From = "james.williams@co.navajo.az.us" Msg.Body = "This is a test email." Msg.Subject = "New Record(s)" Smtp.Send(Msg)
I'm getting an exception thrown at the Smtp.Send(Msg) line and can't figure out exactly why. Here's the exception message that I get:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation.
According to my network guru guy, "mail.co.navajo.az.us" should resolve to our mail server. Is there something I'm missing? I got this code directly from a book example.
Since I'm sending the email internally, is there anything different I must do? Our mail server is a MS Exchange mail server. Thanks for any help.
Jim Williams [ james dot williams ( at ) co dot navajo dot az dot us ],
2005-03-15 12:35:17
#
-
RE: Problems sending email
[ Reply ]
Here are the details of the error message I get. It seems to point to a problem with a library:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text ************** System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80029C4A): Error loading type library/DLL. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at EmailTest.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\james.williams\My Documents\Visual Studio Projects\EmailTest\Form1.vb:line 69 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies ************** mscorlib Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll ---------------------------------------- EmailTest Assembly Version: 1.0.1900.18598 Win32 Version: 1.0.1900.18598 CodeBase: file:///C:/Documents%20and%20Settings/james.williams/My%20Documents/Visual%20Studio%20Projects/EmailTest/bin/EmailTest.exe ---------------------------------------- System.Windows.Forms Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll ---------------------------------------- System Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll ---------------------------------------- System.Drawing Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll ---------------------------------------- System.Xml Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll ---------------------------------------- System.Web Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2037 CodeBase: file:///c:/windows/assembly/gac/system.web/1.0.5000.0__b03f5f7f11d50a3a/system.web.dll ----------------------------------------
************** JIT Debugging ************** To enable just in time (JIT) debugging, the config file for this application or machine (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.
For example:
<configuration> <system.windows.forms jitDebugging="true" /> </configuration>
When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the machine rather than being handled by this dialog.
Jim Williams [ james dot williams ( at ) co dot navajo dot az dot us ],
2005-03-15 13:24:45
#
-
RE: Problems sending email
[ Reply ]
The following: ----------------------------------------------------------- Dim Smtp As SmtpMail Smtp.SmtpServer = "mail.co.navajo.az.us" Dim Msg As MailMessage = New MailMessage Msg.To = "james.williams@co.navajo.az.us" Msg.From = "james.williams@co.navajo.az.us" Msg.Body = "This is a test email." Msg.Subject = "New Record(s)" Smtp.Send(Msg) -----------------------------------------------------------
Has only one error that I see. The first line. It should read: ----------------------------------------------------------- Dim Smtp As New SmtpMail -----------------------------------------------------------
Hopefully this helps.
Greg Conely [ gjconely ( at ) imagementor dot net ],
2005-05-27 11:55:09
#
-
What if my code will reside on a webhost
[ Reply ]
I don't have my server at home set up to send mail (or at least I don't think I do) so I have to put the code on the webhost to test it. When i put the web.mail code up it fails-- their docs say they support cdonts
What am I maissing here
Let me go try to recreate the error
Paze [ paisleygo ( at ) hotmail dot com ],
2005-04-09 05:28:31
#
-
What do i need about the smtpserver?
[ Reply ]
I'm attempting to send mail using our own mail server.When I set the SmtpServer,I got an error that System.Runtime.InteropServices.COMException: Server have refused one or more direction.Server Response:503 AUTH first. Why?
jedliu [ jedliu ( at ) sohu dot com ],
2005-06-20 23:10:48
#
-
Problem in sending email
[ Reply ]
Dim email As New MailMessage Dim Smtp As SmtpMail Smtp.SmtpServer = "ESS Mail Administrator ISRCHELPDESK@otis.com)" email.To = "Sandesh.Kulkarni@otis.com" email.From = "Abhaya.Dongargaonkar@otis.com" email.Body = "Trial email" email.Subject = "Good morning" email.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.Send(email)
error is.....
An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll
Additional information: Could not access 'CDO.Message' object.
thanks Abhaya
Abhaya [ Abhaya dot Dongargaonkar ( at ) otis dot com ],
2005-08-10 00:01:56
#
-
RE: Problem in sending email
[ Reply ]
This line looks suspisious
Smtp.SmtpServer = "ESS Mail Administrator...
Dana [ dlong ( at ) pcgus dot com ],
2005-09-06 12:37:51
#
-
RE: Problem in sending email
[ Reply ]
in ISS manager in smtp server properties..go to access tab and start relay...give correct ip...
devarajan [ cheraideva2 ( at ) yahoo dot com ],
2008-12-09 04:32:59
#
-
Use Outlook Express in VB.Net , What is its DLL
[ Reply ]
Please tell me DLL name for using Outlook Express (for Messaging) in VB.Net 2003
Hardik Shah [ har_sha_99 ( at ) hotmail dot com ],
2005-08-15 02:39:16
#
-
RE: Use Outlook Express in VB.Net , What is its DLL
[ Reply ]
To implement outlook functionality in VB.NET,
simply write one line of code
imports Outlook
Study the namespace and get your application working with Outlook.
Happy Mailing...!! :)
Paresh
Paresh Rathod [ paresh_atlas ( at ) yahoo dot com ],
2007-07-13 23:47:18
#
-
What is my "From" address?
[ Reply ]
I have managed to get my application working using the SMTP server from my ISP, but I now want to create an application that will be hosted locally on a few peoples laptops and I will not know their e-mail addresses. Can I set the "From" field to a generic name, such as "Localhost"?
If not, how can I find the user's address to put in the "From" field?
Alan McDermott [ dundealing ( at ) btinternet dot com ],
2005-08-30 10:18:08
#
-
Sending many e-mails (but not beeing a Spammer)
[ Reply ]
I need to send a list o e-mails addrressed to the Employees (about 90 persons) from out of a corporate employee database.
To do it : I think of writting a code with a Loop sweeping the selected records of the data base and within this loop putting the asp.net instructions to send one e-mail to each employee.
My doubt is :
Processing this way may my application be taken as a Spam sender ?
IF it happens what or how must be the code in asp.net (VB) to work around this problem
Bas [ bw ( at ) mbsotmaster dot com dot br ],
2005-10-19 07:03:05
#
-
mail ends up in queue
[ Reply ]
Hi, i am trying to send a mail but after executing the Send command i can see my mail ending up in the Queue but never actually gets sent.
What am i doing wrong?
Bas
Bas Jaburg [ jaburg ( at ) gmail dot com ],
2005-11-17 01:07:17
#
-
RE: mail ends up in queue
[ Reply ]
I am having the same problem. Any solution to this problem?
anthony liu [ antonyliu2002 ( at ) yahoo dot com ],
2006-03-03 10:25:23
#
-
send mail in .net 2.0
[ Reply ]
MailMessage mail = new MailMessage(); mail.From = (new MailAddress("bbb@viet-sun.com", "name")); mail.To.Add("aaa@viet-sun.com"); mail.Subject = "test mail"; mail.Body = "test"; SmtpClient send=new SmtpClient("mail.viet-sun.com"); send.Send(mail); It's ok. But if I send mail to ccc@yahoo.com (this mail existed). I got a error "Mailbox unavailable. The server response was: not local host yahoo.com, not a gateway". Please help me.
Anh Thu [ anhthu0112 ( at ) yahoo dot com ],
2006-01-03 18:50:42
#
-
How to use the exchange sever in System.Web.Mail
[ Reply ]
I want to use my Microsoft Exchange server to send mails through my application...my exchange server requires user name and password.
Abhishek [ abhishek dot chandra ( at ) wipro dot com ],
2006-05-18 05:39:17
#
-
Sending Email Without IIS Installed
[ Reply ]
I developed a VB.NET app that sends a report to a specified list of users. The app works fine from my dev machine, but not from our test server. This is a backend server that does not have IIS installed. I get the following whenever I attempt to send an email from that machine:
The following error was encountered when generating the ... Report for 31 May 2006 Source -> System.Web Message -> Could not access 'CDO.Message' object. StackTrace -> at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at ToolCapacityReport.ToolCapacity.SendReport() at ToolCapacityReport.ToolCapacity.Main() Execution Date/Time -> 5/31/2006 12:51:53 PM The following InnerException reported: Source -> mscorlib Message -> Exception has been thrown by the target of an invocation. StackTrace -> at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) The following InnerException reported: Source -> CDO.Message.1 Message -> The "SendUsing" configuration value is invalid.
StackTrace -> I believe this is because IIS (and hence SMTP Service) is not installed on the machine. The SmtpServer I reference is a relay server which does not require authentication from the originating server.
The basic question is if a VB.NET application can send an email without IIS being installed on the host machine?
BLaflin [ bob_laflin ( at ) hotmail dot com ],
2006-06-02 06:10:15
#
-
IIS SMTP Service in .NET 2.0
[ Reply ]
Hi,
Is it required to enable the SMTP service on the web server in order to send mail?
John [ JohnLumidao ( at ) hotmail dot com ],
2006-09-01 06:17:11
#
-
Sending Mail thru asp.net
[ Reply ]
Hi Friends , Sending Mail thru system.web.mail is really a fun. what you have to done is import system.web.mail if using framework 1.1 else use system.net.mail
code is first import all namespaces imports system.web.mail imports system.web.mail.smtpmail imports system.web.mail.mailmessage
then do the folowing taslk on an event
dim mailmsg as new mailmessage() mailmsg.from="your mail id" mailmsg.to="Reciepents mail id" mailmsg.cc=" cc id" ' optional mailmsg.bcc="bcc id" 'optional mailmsg.subject="your subject goes here" mailmsg.body="your msg goes here"
smtpmail.smtpserver="your server" smtpmail.send(mailmsg)
thats all.this code will send your mail if you are sending mail thru localhost then you must configure your IIS by opening IIS properties,then click its ACCESS tab.after that you will find RELAY tab. click it and then click on NEW button and add your localhost ip address. most time it is 127.0.0.1 this code works for me.hope it will help you. for more information please mail me
Mukesh [ Mukesh_is4pal ( at ) rediffmail dot com ],
2006-10-13 01:57:30
#
-
RE: Sending Mail thru asp.net
[ Reply ]
Thanks adding the localhost ip in allowed relay servers helped
Sanjeev Arora [ sanju_arora_19 ( at ) yahoo dot com ],
2009-03-27 13:27:43
#
-
Exception has been thrown by the target of an invocation.Mail asp.net 1.1
[ Reply ]
Exception has been thrown by the target of an invocation. - Error Initializi ng the Standalone Network Communications, Module - c:\program files\skelta\workf low.net\bin\Workflow.NET.dll, Source - at System.RuntimeMethodHandle._InvokeC onstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruc t signature, RuntimeTypeHandle declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, B inder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder bin der, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binde r binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
Nitin [ nitin dot vij ( at ) in dot mindmillsoftware dot com ],
2006-11-05 22:28:57
#
-
where do i recieve my mails?
[ Reply ]
i followed the simple mail procedure of yours but i dont understand where do i recieve my mail.Pls help me
code used:
MailMessage mail=new MailMessage(); mail.To = Txtto.Text; mail.From = Txtfrom.Text; mail.Subject=Txtsubject.Text; mail.Body= Txtbody.Text; SmtpMail.SmtpServer="localhost"; SmtpMail.Send(mail);
viky [ rahulblueonline_24hrs ( at ) yahoo dot co dot in ],
2006-11-07 07:24:20
#
-
failure mail error
[ Reply ]
i have use your technic, but always i m recieve same message
My code:
Dim msg As New MailMessage msg.To.Add("pro_vikas682@yahoo.co.in") msg.To.Add("veer_panesar@yahoo.com")
msg.From = New MailAddress("pro.vikas682@gmail.com") msg.Subject = "Test mail using .net2.0" msg.SubjectEncoding = System.Text.Encoding.UTF8 msg.Body = "This is my msg Body" msg.BodyEncoding = System.Text.Encoding.UTF8 msg.IsBodyHtml = False msg.Priority = MailPriority.High
Dim client As New SmtpClient
client.Credentials = New System.Net.NetworkCredential("pro.vikas682@gmail.com", Me.TextBox1.Text) client.Port = 587 'i have also change 465 port number client.Host = "smtp.gmail.com" client.EnableSsl = True
please sent solution as soon as possible
thanks client.Send(msg)
vikas [ pro_vikas682 ( at ) yahoo dot co dot in ],
2007-04-14 01:27:29
#
-
RE: failure mail error
[ Reply ]
hello i m having a problem that i m able to send a mail to the same domain(my server domain) but if i m sending the mail to another domain like gmail,yahoo... it gives an error....the error(exception) is... The server rejected one or more recipient addresses. The server response was: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
n my code is... MailMessage objmail = new MailMessage(); objmail.From= "abcd@myServerName.com"; objmail.To = "abc@yahoo.com"; objmail.Subject = "Hi This Is Mail Test from Neetu"; objmail.Body = "Hello!! This is Neetu...How Are You"; objmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "0"); SmtpMail.SmtpServer= "smtp.myServerName.com"; objmail.Priority = MailPriority.High; SmtpMail.Send(objmail);
it is throwing an exception as i mentioned n if i m useing objmail.To= "abcd@myServerName.com";
then the mail is going successfully
please help me its urgent n thanx in advance
Neetu [ neetumahe ( at ) gmail dot com ],
2007-12-28 21:06:11
#
-
Sending mail in 2003 VB.Net Windows application
[ Reply ]
I am not bale to use "System.Web.Mail.MailMessage" in windows Applications
Jhanshy [ jhanshy dot j ( at ) jktech dot com ],
2007-08-10 03:15:05
#
-
Unable to catch SMTP error in Dotnet application
[ Reply ]
Using System.Web.Mail.SMTPMail.Send(); this method sends the email 'from' address 'to' address. If the 'to' address mail box is full, this method doesn't return any error to the Dotnet application. But inernally SMTP will generate error 522, error 552 , and sends a failure delivery to the 'from' address.
Error: Your message did not reach some or all of the intended recipients. Well how to capture this error in our Dotnet applicaion.
Please any one help on this.
chayan [ chayan dot mehrotra ( at ) tcs dot com ],
2007-11-22 04:04:18
#
-
Directory Path Not Specified Mail Error
[ Reply ]
I am using following function in BL class. [clsMails] Class Functions -> sendAdminMail() & sendClientMail() --------------------------------------------------- System.Web.HttpException: The pickup directory path is required and was not specified. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040222): The pickup directory path is required and was not specified. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at clsMails.sendAdminMail(String avSubject, String avBody) in d:\WebCorp\sitename.com\httpdocs\App_Code\clsMails.cs:line 50 -------------------------------------- Following is the Code in Class: -------------------------------------- using System.Web; using System.Web.Mail;
public int sendAdminMail(string Subject, string Body) { try { SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer"]; MailMessage msg = new MailMessage(); msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtsperver"] = ConfigurationSettings.AppSettings["SmtpServer"]; // SMTP Server Mail Settings msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 25; // Port for Sending Mails msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 1; // Authentication to be Used: 1 Denoites Plain/ Basic Authentication msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"] = 60; // mail Time Out Period // AuthentiCate The Mails msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]= 1; msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"]= ConfigurationSettings.AppSettings["SMTP-Out-User"]; msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"]= ConfigurationSettings.AppSettings["SMTP-Out-Pass"];
msg.From = ConfigurationSettings.AppSettings["AdminSender"]; // From is Defined in Config File With Authenication User & Password msg.To = ConfigurationSettings.AppSettings["AdminReceiver"]; // To : Receiver is Defined in Web.Config. msg.Subject = Subject; msg.BodyFormat = MailFormat.Html; msg.Body = Body; SmtpMail.Send(msg); return (1); } catch (Exception ex1) { HttpContext.Current.Response.Write(ex1); return (0); } } ========================== Is there anything wrong from my end??? I have defined, Sender, Receiver, Sender Authentication User/Password in Web.Config.
I am getting this error once i do it on live web server while from localhost its working fine.
My host company says to change the SMTP Port, i did so as they suggest but failed.
Please suggest me why online live server giving me error while same code is working on another website.
Please help
Regards Vivek Singh Web Developer-India
vivek singh [ vivek7144 ( at ) gmail dot com ],
2008-04-21 06:39:51
#
|