send email using c# without using CDONTS

  • Thread starter Thread starter Mohammed Abdel-Razzak
  • Start date Start date
M

Mohammed Abdel-Razzak

dear sirs
i want to send email using c#
but i don`t want to use CDONTS
or tell me how can i use it
i don`t know any thing about CDONTS

thanks
 
The old messages re the subject are unavailable.

I used this routine. Works ok. There is a limit on size. Depends on OS.

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;

namespace TeleM
{

public class Email:Form
{
private string e_address;
private string subject;
private string body;

public Email(string e_address, string subject, string body)
{
this.e_address=e_address;
this.subject=subject;
this.body=body;
do_mail();
}
private void do_mail()
{
try
{
string message = string.Format( "mailto:{0}?subject={1}&body={2}",
e_address, subject, body );
Process.Start( message );
}
catch
{
MessageBox.Show("Message is too
big.","Error",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
}
}
 
string message = string.Format( "mailto:{0}?subject={1}&body={2}",

the Internet Explorer mailto protocol has some serious drawback. the URL
size cannot exceed 2kb. so this is useless in general.

what I suggest is to search for the implementation of sending mail via SMTP.
it's fast and reliable.

Regards,
Wiktor Zychla
 
Wiktor Zychla said:
the Internet Explorer mailto protocol has some serious drawback. the URL
size cannot exceed 2kb. so this is useless in general.

Not so for general use.
what I suggest is to search for the implementation of sending mail via SMTP.
it's fast and reliable.

Please give some references.

Patrick.
 
When I set up the email program I get this error message:

The requested name is valid and was found in the database,
but it doesn't have the correct data being resolved for.

This error occurs in Form1

at this line:

LSMTP.Send(LMsg);

The bottom text area in Form1 says:
Resolving hostname smtp.xxxxx.yy

Please assist.

Patrick.
 
Patrick de Ridder said:
The requested name is valid and was found in the database,
but it doesn't have the correct data being resolved for.

AFAIK this problem has sth to do with DNS.
Resolving hostname smtp.xxxxx.yy

Have you checked if smtp.xxxxx.yy exists?
Statrt->Run:
ping smtp.xxxxx.yy
telnet smtp.xxxxx.yy 25

RGDS PSG
 
Yes, it exists. The app. runs ok if the connection is already established,
but not if it isn't.
 
Patrick de Ridder said:
Yes, it exists. The app. runs ok if the connection is already established,
but not if it isn't.

You mean connection with your server in SMTP protocol, or connection with
the Internet?
Most probably it is connection with the Internet that is not established at
the moment of error. Address smtp.xxxxx.yy must be translated to IP with
help of DNS server, if DNS is not available then name query will rise an
error mentioned before. I suggest you to simply catch this exception and
inform user about it in more understandable way. You may also think about
trying to establish a connection, but that is a different issue.

RGDS PSG
 
When I run the program on a W98 machine, there is no problem at all.
I get the error on a XP machine.
There is no problem if I am already connected to the internet.
An email client previously working ok with smtp now produces socket error
#11004.
Do you have any further suggestions?
Patrick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top