• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

send email with out smtp server?

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
expertfan
Asked:
expertfan
  • 10
  • 10
1 Solution
 
ArkCommented:
0
 
expertfanAuthor Commented:
friends, i need vb6 code to achieve this. thanks.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ArkCommented:
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
 
ArkCommented:
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
 
expertfanAuthor Commented:
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
 
ArkCommented:
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
 
expertfanAuthor Commented:
hey,

i got the following error.

run-time error '-2147220973' (80040213)
The transport failed to connect to the server
0
 
ArkCommented:
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
 
expertfanAuthor Commented:
even with this code, i am getting the same error. i too used gmail id itself.
0
 
expertfanAuthor Commented:
i am connected to internet via proxy server does this make a differnce?
0
 
ArkCommented:
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
 
expertfanAuthor Commented:
i have only 'microsoft outlook' client, how can check out this ?
0
 
ArkCommented:
Which connection does your MSOutlook use? Exchange/Pop3 etc?
Actually, you can use MSOutlook object to send e-mail using MSOutlook settings
0
 
expertfanAuthor Commented:
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
 
expertfanAuthor Commented:
hi ark,

your code is working fine when there is no firewall.


but doesn't work when behind firewall....please advise.
0
 
ArkCommented:
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
 
ArkCommented:
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
 
expertfanAuthor Commented:
>>>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
 
expertfanAuthor Commented:
thanks Ark, i hope some one can get this working for 'behind the firewall' too...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now