Sending Mails to external domains in .net 1.1

R

rose

Hi everyone,

I have been searching the net but couldnt find a solution to my
problem of sending emails to external domains in Asp.net 1.1.

I am not getting any error and the Mail Send message returns 1 or
success but the mail doesnt go. I am using the Mail Server as the
Companies Exchange Server which has full rights to send emails to any
domain. This is proved by the fact that if I sent email through
outlook to hotmail,gmail etc , it works fine. Also I have created a
user in the Exchange Server will full rights but still the problem
persists. I have copied my code below to give you an idea.

MailMessage objMsg = new MailMessage();

objMsg.From ="(e-mail address removed)";
objMsg.Subject = objMailDM.MailSubject;
objMsg.Body += objMailDM.MailBody;
objMsg.To ="(e-mail address removed)";

SmtpMail.SmtpServer =
ConfigurationSettings.AppSettings["MailServer"]; //this entry will go
to web.config
// set SMTP server port
objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/
smtpserverport",25);
objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/
sendusing",2);
//objMsg.BodyFormat = System.Web.Mail.MailFormat.Html;
objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/
smtpauthenticate",1);
objMsg.Fields.Add"http://schemas.microsoft.com/cdo/configuration/
sendusername", "username");
objMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/
sendpassword", "pass");
try
{
SmtpMail.Send(objMsg);
return 1;
}
 
T

ThatsIT.net.au

your code looks like cdo using in classic asp.

try something simple like

Dim message As New MailMessage("sender@address", "from@address", "Subject",
"Message Text")

Dim emailClient As New SmtpClient("Email Server Name")

emailClient.Send(message)
 
S

sloan

Go here
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

download the code.

This will give you a pretty good baseline to test against.

I've "grouped together" the germane cdo properties fairly well too.

But it is 1.1 code for sending emails.

Try to get my code working (by changing some config file settings) BEFORE
trying to cut and paste out code you think you need.
(or better yet, keep it as a library)
 
R

rose

Thanx...After trying all the solutions available over the net, I ended
up with the above code and it is actually working fine. I finally got
it running but the mails to hotmail and google took some time to reach
making me think that the code didnt work.
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top