|
I am using System.Web.Mail.MailMessage
and I couldn't find a way to send email to a Group name.
Group is logical list created using Out look/Lotus Notes etc.. and this list may change. so using group name is preferred rather than all email ids.
Iam getting this error
Could not access 'CDO.Message' object. Exception has been thrown by the target of an invocation. The server rejected one or more recipient addresses. The server response was: 501 Syntax error, parameters in command \"RCPT TO: <TST - Group Name>\" unrecognized or missing\r\n"
I am from dust and to dust I will return
|
|
|
|
|
2200
97800
8.5%
9657190263 ragini
______________________________________
I am using C++ to send mails using CDO.
my code is like this.
void main()
{
CoInitialize(NULL);
IMessage* pMsg = NULL;
IConfiguration* pConfig=NULL;
IDropDirectory* pDropDirectory= NULL;
ISMTPOnArrival* pSMTPOnArrival;
// ISMTPOnArrival->
Fields* pFlds1 = NULL;
_Stream* pstream;
/*
** Create an instance of the Message COM class.
*/
HRESULT hr = CoCreateInstance(__uuidof(Message),
NULL,
CLSCTX_ALL,
__uuidof(IMessage),
reinterpret_cast<void**>(&pMsg));
assert(SUCCEEDED(hr));
HRESULT hr3 =
CoCreateInstance( __uuidof(Configuration),
NULL,
CLSCTX_ALL,
__uuidof(IConfiguration),
(void**) &pConfig
);
Field* pFld1 = NULL;
pConfig->Load(cdoDefaults,NULL);
pConfig->get_Fields(&pFlds1);
pFlds1->get_Item(_variant_t(cdoSendUsingMethod),&pFld1);
pFld1->put_Value(_variant_t(cdoSendUsingport));
pFld1->Release();
pFlds1->get_Item(_variant_t(cdoSMTPServerPickupDirectory),&pFld1);
pFld1->put_Value(_variant_t("C:\\Inetpub\\mailroot\\Pickup"));
pFld1->Release();
pFlds1->get_Item(_variant_t cdoSMTPServerPort),&pFld1);
pFld1->put_Value(_variant_t((long)25));
pFld1->Release();
pFlds1->get_Item(_variant_t(cdoSMTPServer),&&pFld1);
pFld1->put_Value(_variant_t("ipAddress of smtp server"));
pFld1->Release();
pFlds1->;get_Item(_variant_t(cdoSMTPAuthenticate),pFld1);
pFld1->put_Value(_variant_t(cdoAnonymous));
pFld1->Release();
pFlds1->get_Item(_variant_t(cdoSMTPAccountName),&pFld1);
pFld1->put_Value(_variant_t("computer name"));
pFld1->Release();
pFlds1->get_Item(_variant_t(cdoSendEmailAddress),&pFld1);
pFld1->put_Value(_variant_t("mymail.@mail.com"));
pFld1->Release();
pFlds1->get_Item(_variant_t(cdoSendPassword),&pFld1);
pFld1->put_Value(_variant_t("password"));
pFld1->Release();
pMsg->put_Configuration(pConfig);
HRESULT hrs=pMsg->Send();
but my mails are queued in queue directory.
|
|
|
|
|
I already setup username/password in Outlook Express. But the CDO still requires those fields? It sounds not good.
|
|
|
|
|
In my application I need to send email within my office. I can send a mail from one user account to another. But I need to know how to save sent mail in the sent items of the sender.
|
|
|
|
|
We need to send 1000s of legitimate order confirmation emails because of our business (we sell DVDs).
Does anyone know how to use the Microsoft dot-net components to do this?
We need to:
Connect
Send
Send
Send
...
Disconnect
Or does anyone know of a 3rd party component that does this?
IP*Works! does this BUT it's way too expensive and we only need this one component of their suite.
Pete
MovieMars.com
|
|
|
|
|
Hi, for those people getting 451 errors when posting to SMTP then the solution is usually to ensure you are not sending cr's or lf's on their own as these are disallowed in emails.
In vb.net a simple
Body = Body.Replace(vbCr,"").Replace(vbLf,"")
Should sort your problem out for you (at least it did for me!)
Happy emailing
|
|
|
|
|
If you are using authentication the code will not work. You must set sendusing and smtpauthenticate to the same thing:
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 1);
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);
Depending on what you're using, set them to the follwing:
cdoAnonymous - 0 - Perform no authentication.
cdoBasic - 1 - Use the basic (clear text) authentication mechanism.
cdoNTLM - 2 - Use the NTLM authentication mechanism.
Brother C
|
|
|
|
|
thank you
this helped me fix my problem
thanks a lot
hepsi
|
|
|
|
|
hello,
i need help please..
i created an asp.net c# code to send email. the TO Address is constant as it put in the code, so i want this field to be variable( users input it).another problem with attatchment, it did not work with me
i tried my best but no luck, so help me plz
this is a code:
<% @Page Language="C#" %> <% @Import Namespace="System" %> <% @Import Namespace="System.Web.Mail" %>
>
An email has been sent to: aaa@hotmail.com,
please check your email.
<%
MailMessage oMsg = new MailMessage();
oMsg.From=txtFrom.Value;
oMsg.To = txtTo.Value;
oMsg.Cc = "aaa@yahoo.com";
oMsg.Bcc = "aaa@gmail.com";
oMsg.Subject = txtSubject.Value;
oMsg.Body = "Hello World!";
MailAttachment attachment = new
MailAttachment("c:\t.txt");
oMsg.Attachments.Add(attachment);
%>
<%SmtpMail.Send(oMsg);
oMsg = null;
%>
i am waiting to ur reply
Regards,,,
|
|
|
|
|
|
private int SendMail2(string mailTo, string mailFrom,string htmlBody,string stripAdd,string UserName, string Pwd)
{
MailMessage mail = new MailMessage();
mail.To = mailTo;
mail.From = mailFrom;
mail.Subject = "this is an authenticated test email using System.Web.Mail.";
mail.Body = "Some text goes here";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = stripAdd;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]= 25;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]= 2;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]=1;//basic authentication
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"]= UserName; //set your username here
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"]= Pwd; //set your pwd
SmtpMail.SmtpServer = stripAdd; //your real server goes here
SmtpMail.Send( mail );
return 1;
}
MY Above mentioned code does not.... work... i am using and external mail server....... Please help me out.. MY Exception Reads Like:
System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. --- 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.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- 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 TestMailApp.WebForm1.SendMail2(String mailTo, String mailFrom, String htmlBody, String stripAdd, String UserName, String Pwd) in c:\inetpub\wwwroot\testmailapp\webform1.aspx.cs:line 80 at TestMailApp.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\testmailapp\webform1.aspx.cs:line 28
N!ls 
|
|
|
|
|
You dont by chance have Virus Scan do you? The latest version has an outgoing email msg blocker that blocks any application not in its safe list from sending out on port 25. Check the Access Protection settings (from Virus Scan Console).
|
|
|
|
|
|
|
--http://schemas.microsoft.com/cdo/configuration/--
http://msdn.microsoft.com/library/en-us/cdosys/html/37be0471-06bd-489d-8bf2-5c22bb7ce17c.asp
--Enumerated Values--
http://msdn.microsoft.com/library/en-us/cdosys/html/c8834714-3144-4fec-808a-112aa1257b08.asp
|
|
|
|
|
|
is Exact what I need simple and it works!!
|
|
|
|
|
I used this in C++ and it works fine if the server doesn't have autentication. If it has there's an error, the same as if i don't use the authentication part.
Does the Fields proterty have to be menaged diferently in C++??
Thanks
Adriano
|
|
|
|
|
This article was a lifesaver for myself and my client. Thanks!
|
|
|
|
|
i m facing below error please give me solution
Server Error in '/Email' Application.
--------------------------------------------------------------------------------
The message could not be sent to the SMTP server. The transport error code was 0x800ccc6a. The server response was 451 Requested action aborted: error in processing
|
|
|
|
|
Unable to send mail using an external SMTP server with CDOSYS. Configuration settings are as follows:
cdoSendUsingMethod = cdoSendUsingPort
cdoSMTPServer = "my smtp server name"
cdoSMTPServerPort = 25
cdoSMTPAuthenticate = cdoBasic
cdoSendUserName = "my user name"
cdoSendPassword = "my password"
The local SMTP service seems to pick up the mail instead of the external smtp server specified. The mail sits in the local SMTP service's pickup folder if the service is stopped.
Could anyone please help me send a mail using the external SMTP server irrespective of the presence of the local SMTP service.
NOTE: I have Outlook Express and IIS SMTP service installed on the system
Thanks,
Ramesh
|
|
|
|
|
I am having the same damn problem
|
|
|
|
|
anyone who have managed to solve the problem of sending mails using externam smtp server through the damn CDOSYS.
|
|
|
|
|
the actual error i get is outlined below -
System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server
this damn thing has been working fine, suddenly is giving me this funny error - anyone who has an idea.
|
|
|
|
|
I can't get this code to work over my company network.
I am trying to send an e-mail from a web-service using my own company e-mail account.
I get an exception with the explanation 'The transport failed to connect to the server'.
The C# code is below. Can anyone explain why this is failing?
Thanks.
SmtpMail.SmtpServer = "MyCompanySMTPserver";
try
{
MailMessage msg = new MailMessage();
msg.To = "to_email@mycompany.com";
msg.From = "my_email@mycompany.com";
msg.Subject = "test mail";
msg.Body = "This msg was sent by SMTPMail";
msg.BodyFormat = MailFormat.Text;
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "mycompanySMTPserver");
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",25);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",2); //2 to send using SMTP over the network
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1); //1 = basic authentication
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "mySMTPusername");
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mySMTPpassword");
SmtpMail.Send(msg);
}
catch(Exception ex)
{
string s = ex.ToString();
}
================================================
ZipScan: Search Zip, CAB and other archive files
http://www.foobarsoftware.com/
|
|
|
|