CSmtpConnection problems

I am trying to send mail to different domains like yahoo , gmail , and other.
I am using CSMTPConnection release and it doesnt wanna send.It only sends mail to the ones that have the same domain like mine on the MS Outlook.
How do i fix this problem? Which smtp server do I need to use?
Thanx  in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mahesh1402IT ProfessionalCommented:
Dont know what exact your problem is but...Have you referred this sample on MSDN :

mahesh1402IT ProfessionalCommented:
You may also refer sample class on codeproject derived from CSmtpConnection :

sjcuAuthor Commented:
One of the issues from the sample in code project is exactly the same as the one i have... so there seems to be a problem.
I am thinking it could be a mail server setting or security issue...
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

mahesh1402IT ProfessionalCommented:
have a look at www.naughter.com ...

There are a lot of sources, and in the network section, you will found CSmtpConnection and CPopConnection.

http://www.naughter.com/freenetwork.html <======

Probably, the port for other mail server is blocked in the firewall.

Try to do a telnet to the port 110. for eg: telnet mail.xxxxx.com 110 in command prompt.

If it is not working, then u can assume that the port is blocked and only your mail server is allowed. Admins do that in order to avoid spam mail generation.

sjcuAuthor Commented:
Ok. I tried the telnet and this is the response i got. I understand the spam part, but this is outgoing mail... So i am not sure why this
should be blocked. However from my outlook i can send mail to other domains.. But from my program its not working.

+OK Microsoft Exchange Server 2003 POP3 server version 6.5.7226.0 (splkexch.span
link.com) ready.

Mahesh, I will look at Naughters site...
Most admins block the ports so that if ur machine is acting as a spam generator and pumping out mails to others, the same can be avoided. The admin can avoid certain apps like Outlook from being blocked.

I was sorry abt the port number.. it is 25. So try telnet that..for eg: telnet mail.xxxxx.com 25 in command prompt.

If it is working, then check whether the port 25 is bind by  some other application or in the same app somewhere before initialising SOCKADDR_IN.

It might be better to write a wrapper class for this purpose and it is already available at http://www.codeproject.com/internet/csmtpconn.asp which was pointed by mahesh.

Hope it will work fine.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sjcuAuthor Commented:
Ok.  I tried with port 25.

220  Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready
 at  Fri, 28 Apr 2006 09:32:05 -0500

I am using the CSMTPConnection class provided by Microsoft (ATL) so i do
CSMTPConnection conn;
sjcuAuthor Commented:

bSuccess = conn.SendMessage(mMsg, NULL, NULL);            

So am i missing something... No i am not using port 25 for anything .. I am not initializing any socket addr, i dont have to every thing
is handled by the CSMTPConnection class.

Do i have to use the code project one...  ?

I suggest , you should try the code project one too.. if that is also not working then there is something really serious that we have to look into.

Before implementing the one from Code Project, try whether the sample tool supplied along in Code project is working or not.. If working, proceed..

mahesh1402IT ProfessionalCommented:
sjcu ,
 you may try codeproject and code from naughter.com site too.

sjcuAuthor Commented:
I tried the sample from the code project, (http://www.codeproject.com/internet/csmtpconn.) and i cannot send the email. However i received an error code .. The class that i use does not give valid error codes so its all the difficult troubleshoot...

550 unable to relay for the outside domain addr. Any ideas as to how to allow acess.

Which anti virus are u using? Is it McAfee? Some anti Virus has the blocking of certain port and exes by default. you can refer with ur SysAdmin regarding this to get the port open if thats the case

And also one more thing. Check the configuration of the mail server you are trying to connect to. May be it wont supprt relaying.. ie. mailing to another domain.. To check this, try mailing to an id in the same domain. If it is successful, then we can confirm that the relaying is blocked in the SMTP mail server you are connecting to.

To rectify this, may be u can install a local SMTP mail server on ur machine and try sending mails. one such SMTP Server is downloadable at http://www.softstack.com/advsmtp.html.

mahesh1402IT ProfessionalCommented:
split me and roshkm.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.