Send E-Mail from VB.Net 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to send an e-mail using one of the examples I got on this group
as follows: (both toemail and myemail are valid e-mail addreses.

'System.Web.Mail' (requires reference to "System.Web.dll"),
''' delcare a new mail message
Dim aMailMessage As New System.Web.Mail.MailMessage

''' set the from address
aMailMessage.From = myemail
''' set the to address and subject
aMailMessage.To = toemail
aMailMessage.Subject = "Test Sending E-Mail from VB."

''' send in Text format
aMailMessage.BodyFormat = System.Web.Mail.MailFormat.Text

''' set the body text
aMailMessage.Body = "This is the text of the email message from
my test Program."

''' add an attachment if you want to
'aMailMessage.Attachments.Add(New
System.Web.Mail.MailAttachment("C:Test.txt",
System.Web.Mail.MailEncoding.Base64))

''' send the email
System.Web.Mail.SmtpMail.SmtpServer = "smtp.sbcglobal.net"
System.Web.Mail.SmtpMail.Send(aMailMessage)

I get an error message stating "Could not access CDO.Message Object. Anyone
know what I'm doing wrong, My e-mail is via RoadRunner Internet connection.
 
I get an error message stating "Could not access CDO.Message Object.
Anyone
know what I'm doing wrong, My e-mail is via RoadRunner Internet
connection.

RoadRunner? Spam Central?
 
Hi Dennis:

I face the same problem three weeks ago so if your opreating system is
windows XP

do the following:
1\ go to control panel, then go to Administrative Tools , after that go to
something called Internet Information services IIS, if you did not find IIS
that mean you have to install this componant from windows XP CD.

2\ When you Open IIS go to the Local Computer and click plus sign you will
find
something called Default SMTP Virtual Server, right click and go to the
access tab
after that click relay button add IP address this one :"127.0.0.1" and set
System.Web.Mail.SmtpMail.SmtpServer = "127.0.0.1" and your problem will be
solved God willing, If you want more infromation about this error message
which is familire go to

http://www.systemwebmail.net/faq/4.2.3.aspx

Husam
 
hi,
i had this problem when i was learning mailing through vs2003.
right now i dont remember what i had done but i think i've updated my
OS with latest Service Pack available at Microsoft site and it started
working. also check that you have latest version on IIS on your pc. coz
it might also require for your programm.
 
hi,
i had this problem when i was learning mailing through vs2003.
right now i dont remember what i had done but i think i've updated my
OS with latest Service Pack available at Microsoft site and it started
working. also check that you have latest version of IIS with latest
Service Pack on your pc. coz it might also require for your programm.

Lucky
 
hi,
i had this problem when i was learning mailing through vs2003.
right now i dont remember what i had done but i think i've updated my
OS with latest Service Pack available at Microsoft site and it started
working. also check that you have latest version of IIS with latest
Service Pack on your pc. coz it might also require for your programm.

Lucky
 
Not everyone has IIs installed. I want to send e-mail from my application
when the user clicks a button "Contact Us"' and the user may not have IIS
installed.

Isn't there a way to find the user's e-mail server and use that name?
 
Maybe you need authetication on your smtp server for example:
//using System.Web.Mail;
eMail = new MailMessage();
eMail.BodyFormat = MailFormat.Text;
eMail.From = _SendFrom;

eMail.Fields[http://schemas.microsoft.com/cdo/configuration/smtsperver]
= "SMTPServerName";

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]
= 25;

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]
= 2;
if (SMTPUser != null && SMTPPassword != null)
{

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]
= 1;

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"]
= "SMTPAUTHUser";

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"]
= "SMTPAUTHPassword";
}
eMail.To = "recipients";
SmtpMail.SmtpServer = SMTPServerName;
SmtpMail.Send(eMail);
//
see this link:
http://msdn.microsoft.com/library/d.../cdosys/html/_cdosys_schema_configuration.asp
 
I have heard that some SMTP servers won't let you send Email without a POP
transaction first. I think that is standard security in many servers to
prevent unauthorised people and spammers from using their servers. It is not
just SMTP authorisation which can solve your problem. My Email server does
this too.

So try logging into your POP mail before you try to send the mail through
SMTP. I think things will work for you.

Regards
Cyril
 
Yes, there are 2 basic methods:

- SMTP authentication: you pass the user/password
- POP before SMTP: you need to pop messages first (to prove that you own the
account) and they you have a time window (30 minutes or so) to send
messages.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers:
http://www.mztools.com
 
Back
Top