Solved

send email with out smtp server?

Posted on 2006-10-19
20
316 Views
Last Modified: 2011-10-03
hi,

1. if we have just an internet connection and no smtp server is it possible to send e-mail? if yes how?

2. if not, then can we send e-mail if we have an account in say 'hotmail' or 'yahoo mail' or 'gmail'?
0
Comment
Question by:expertfan
  • 10
  • 10
20 Comments
 
LVL 27

Expert Comment

by:Ark
ID: 17778096
0
 
LVL 27

Expert Comment

by:Ark
ID: 17778138
0
 

Author Comment

by:expertfan
ID: 17783806
friends, i need vb6 code to achieve this. thanks.
0
 
LVL 27

Expert Comment

by:Ark
ID: 17785365
Directly from above link:
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
     
'This section provides the configuration information for the remote SMTP server.
     
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yoursite.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
     
' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="somemail@yourserver.com" 'Change to your user name account at remote SMTP server, i.e. expertfan@hotmail.com
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword" 'Change to your password at remote SMTP server
     
ObjSendMail.Configuration.Fields.Update
     
'End remote SMTP server configuration section==
     
ObjSendMail.To = "someone@someone.net" 'recepient address
ObjSendMail.Subject = "this is the subject"   'Subject
ObjSendMail.From = "someone@someone.net" 'your address
     
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body" 'you can use HTML tags here, i.e. "<b>Hello world</b>"
ObjSendMail.TextBody = "this is the body"
     
ObjSendMail.Send
     
Set ObjSendMail = Nothing
0
 
LVL 27

Expert Comment

by:Ark
ID: 17785369
PS
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yoursite.com" 'change to your remote SMTP server address, i.e. "mail.hotmail.com"
0
 

Author Comment

by:expertfan
ID: 17786457
Ark,

what are these

http://schemas.microsoft.com/cdo/configuration/sendusing

these URLs are not opening i even tried http://schemas.microsoft.com/cdo/configuration
and http://schemas.microsoft.com/cdo

none of these URLs open, so whats their purpose?
0
 
LVL 27

Expert Comment

by:Ark
ID: 17786482
Those URLs aren't public domains - they are special addresses where CDO mail object check properties settings. Just copy/paste this sample "AS-IS", change:

1. "mail.yoursite.com" - to gmail/hotmail or whatever mail SMTP server address
2. "someone@someone.net" - to recepient address
3. "someone@someone.net" - to your address

If remote SMTP server (gmail, yahoo, hotmail) require authorization with login/password - uncomment following piece of code:

'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="somemail@yourserver.com" 'Change to your user name account at remote SMTP server, i.e. expertfan@hotmail.com
'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword" 'Change to your password at remote SMTP server
 
0
 

Author Comment

by:expertfan
ID: 17786531
hey,

i got the following error.

run-time error '-2147220973' (80040213)
The transport failed to connect to the server
0
 
LVL 27

Expert Comment

by:Ark
ID: 17786876
Did you set all properties according SMTP server requirements?
For example, smtp.gmail.com use port 465 or 587 and require SSL. Here is gmail; sample:

Private Sub Command1_Click()
   Dim ObjSendMail
   Set ObjSendMail = CreateObject("CDO.Message")
     
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True  'Use SSL for the connection (True or False)
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
     
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  'basic (clear-text) authentication
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "expertfan@gmail.com"
   ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "your_password_at_gmail"
     
   ObjSendMail.Configuration.Fields.Update
     
   ObjSendMail.To = "someone@someone.net" 'recepient address
   ObjSendMail.Subject = "this is the subject"   'Subject
   ObjSendMail.from = "someone@someone.net" 'your address
     
   ObjSendMail.TextBody = "this is the body"
     
   ObjSendMail.Send
     
   Set ObjSendMail = Nothing

End Sub

0
 

Author Comment

by:expertfan
ID: 17787138
even with this code, i am getting the same error. i too used gmail id itself.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:expertfan
ID: 17787141
i am connected to internet via proxy server does this make a differnce?
0
 
LVL 27

Expert Comment

by:Ark
ID: 17787169
Some proxies doesn't allow identifictaions from local IPs - they replace it with their own. Can you connect with remote SMTP with any e-mail clients (Outlook Express, The Bat!, Eudora etc.)?
0
 

Author Comment

by:expertfan
ID: 17787178
i have only 'microsoft outlook' client, how can check out this ?
0
 
LVL 27

Expert Comment

by:Ark
ID: 17787199
Which connection does your MSOutlook use? Exchange/Pop3 etc?
Actually, you can use MSOutlook object to send e-mail using MSOutlook settings
0
 

Author Comment

by:expertfan
ID: 17787206
i use 'exchange server'.

but my application should work on machine which will be on internet (might or might not be behind firewall) but it should send out the mail with the client on that PC.
0
 

Author Comment

by:expertfan
ID: 17789113
hi ark,

your code is working fine when there is no firewall.


but doesn't work when behind firewall....please advise.
0
 
LVL 27

Expert Comment

by:Ark
ID: 17792077
Just add your application to the firewall exception list.

You can also try direct winsock e-mailer (http://www.vbforums.com/showthread.php?t=334745), but I'm sure firewal block it too
0
 
LVL 27

Accepted Solution

by:
Ark earned 500 total points
ID: 17792089
PS - try also another smtp servers which use default smtp 25 port - all firewalls usualy don't block this port by default, but anyway all depends on local firewall settings
0
 

Author Comment

by:expertfan
ID: 17793502
>>>try also another smtp servers which use default smtp 25 port

hi ark, do u know any example of hotmail or yahoo which works on 25 port?
0
 

Author Comment

by:expertfan
ID: 17878669
thanks Ark, i hope some one can get this working for 'behind the firewall' too...
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now