?
Solved

send email with out smtp server?

Posted on 2006-10-19
20
Medium Priority
?
328 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 10
20 Comments
 
LVL 28

Expert Comment

by:Ark
ID: 17778096
0
 
LVL 28

Expert Comment

by:Ark
ID: 17778138
0
 

Author Comment

by:expertfan
ID: 17783806
friends, i need vb6 code to achieve this. thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 28

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 28

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 28

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 28

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
 

Author Comment

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

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 28

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 28

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 28

Accepted Solution

by:
Ark earned 1500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

777 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