This works on my ColdFusion server, but not on my Railo server:
<cfset subject = "xxx">
<cfmail usessl="yes" username="xxx#gmail.com" password="xxx" port="465" type="html" server="smtp.gmail.com"
subject="#subject#"
from="xxx#gmail.com" to="xxx#gmail.com">
#subject#
</cfmail>
When I turn Spool enable off my Railo server, I get:
smtp.gmail.com
railo.runtime.exp.NativeException:javax.mail.AuthenticationFailedException:0
At first, Google balked at a program trying to login as me in a different city, but I've told them it was me.
Under unusual activity, I have:
You recognized all the unusual activity below as yours
And the Railo server is in the list.
http://email.about.com/od/gmailtips/qt/How-To-Unlock-Gmail-For-A-New-Email-Program-Or-Service.htm
says to go to
Allow a new application to access your account page at Google.
Also this page:
http://www.placona.co.uk/132/vps/full-google-mail-smtp-power-for-your-domain/
said to use port 587 and usetls instead of usessl.
Related
I am new to REBOL. People blogging about how great REBOL is used sending an email as an example, similar to this example from the "send" documentation:
send luke#rebol.com "Testing REBOL Function Summary"
having read how easy and convenient it is to do this, I excitedly tried to send myself a test email via my GMail account.
I looked at the official GMail help for SMTP/POP to get the relevant SMTP/POP server names:
https://support.google.com/mail/answer/7104828?hl=en
And here is how far the "send" and "set-net" documentation got me:
>> set-net [ myrealusername#gmail.com smtp.gmail.com pop.gmail.com ]
>> send myrealusername#gmail.com "Hello me!"
connecting to: smtp.gmail.com
** Access Error: Cannot connect to smtp.gmail.com
** Where: open-proto
** Near: smtp-port: open [scheme: 'esmtp]
either only
On reflection, of course it didn't work; I told REBOL nothing about wanting to use SSL/TLS, the relevant port numbers, or my GMail password. It must need all of the above to actually send an email.
So how do I do it?
I modified the protocols some years ago to work with gmail. I hope that they still work.
You'll need to run both the prot-ssmtp.r and prot-ssend.r, and you'll need a version of rebol2 which supports ssl. This is either a free view build, or a paid core build.
do https://raw.githubusercontent.com/gchiu/Rebol2/master/Protocols/prot-ssmtp.r
do https://raw.githubusercontent.com/gchiu/Rebol2/master/Protocols/prot-ssend.r
Now, you can either set the user and password manually:
system/schemes/esmtp/user: "username"
system/schemes/esmtp/pass: "password"
or, when the script runs the very first time, you will be asked the values so that they can be set for that rebol instance. The prot-ssmtp uses port 465 but you can modify that if it's no longer correct.
And then it should be as straight forward after setting set-net as:
ssend email#someon.com "This is my message"
Note that we now have email on ren-c which is the open source fork of rebol3.
My Ibrowse HTTP Client is behind a Network and any HTTP request to the outside has to go through a Proxy. Now, Ibrowse has a good example for this. However, i got a little confused. The Proxy behind which i am running the application uses Domain Authentication (this Domain is an Active Directory kinda setup) whereby usually in a browser we would have to enter settings like this (say the domain is "kyaug"),
username: kyaug\[YOUR_DOMAIN_USERNAME]
password: [Domain Password]
This means that [YOUR_DOMAIN_USERNAME] is your Domain Username actually.
Now in the Ibrowse, an example that looks like this comes along:
ibrowse:send_req("http://www.erlang.se/", [], get, [],
[{proxy_user, "XXXXX"},
{proxy_password, "XXXXX"},
{proxy_host, "proxy"},
{proxy_port, 8080}], 5000).
Now, lets say that my situation is as follows:
Domain: kyaug
Domain Username: muzaayj
Proxy Server: ppi.kyu.co.ug
Proxy Port: 3128
Domain Password: xxxxx
Now, When i try thsi below:
Options = [
{proxy_user, "kyaug\muzaayj"},
{proxy_password, "My Domain Password"},
{proxy_host, "ppi.kyu.co.ug"},
{proxy_port, 3128}
],ibrowse:send_req("http://www.google.com",[],post,Data,Options,infinity).
The proxy spits back to me an HTML page informing me that PROXY_AUTH_REQUIRED and many other things about its administrators. Now, i have a feeling that its because i am putting the proxy_user wrongly. In the above, i am supplying this parameter the way the browsers take it as well, probably behind the scenes, its changed into a different arrangement. Some one assist in how i can correct this. How do browsers send their data to a proxy server for authentication given that the username must be append to the Domain to be used for authentication at the Proxy end ?
Have you tried {proxy_user, "muzaayj"} in the options instead of {proxy_user, "kyaug\muzaayj"}?
Have you tried {proxy_user, "kyaug\\muzaayj"}? A single backslash escapes the m back to an m, but a double backslash becomes a single backslash in the string.
I am not familiar with ibrowse, but i think that problem in windows authentication method (ofc it depends on AD config, but i suspect that is NTLM Auth) which ibrowse doesnt supprot.
My config files are identical, except for connection strings.
I'm using IIS on both machines
I elevated the IIS user on the server to ensure it's not a permissions issue
No exceptions are thrown on my server where the e-mails are not being sent
I know the gmail configs are correct because I can send e-mails from my dev box.
Windows firewall is off and the network firewall is not blocking outbound ports.
What else should I look for?
IIS 7 on Win2k8, using ASP.NET w/ C#
SmtpClient smtpClient = new SmtpClient();
smtpClient.EnableSsl = true;
smtpClient.Send(fromAddress, toAddress, subject, body);
Gmail requires authentication from the SMTP client, so you need to fill in the Credentials property on your SmtpClient instance as shown here.
That doesn't explain why it works from your development box (unless the POP3 method still works) but it would explain why the code you have shown doesn't work.
wrap smtpClient.Send(fromAddress, toAddress, subject, body); inside a try catch statment and see what the exception is
I am trying to use System.Net.WebClient in a WinForms application to upload a file to an IIS6 server which has Windows Authentication as
it only 'Authentication' method.
WebClient myWebClient = new WebClient();
myWebClient.Credentials = new System.Net.NetworkCredential(#"boxname\peter", "mypassword");
byte[] responseArray = myWebClient.UploadFile("http://localhost/upload.aspx", fileName);
I get a 'The remote server returned an error: (401) Unauthorized', actually it is a 401.2
Both client and IIS are on the same Windows Server 2003 Dev machine.
When I try to open the page in Firefox and enter the same correct credentials as in the code, the page comes up.
However when using IE8, I get the same 401.2 error.
Tried Chrome and Opera and they both work.
I have 'Enable Integrated Windows Authentication' enabled in the IE Internet options.
The Security Event Log has a Failure Audit:
Logon Failure:
Reason: An error occurred during logon
User Name: peter
Domain: boxname
Logon Type: 3
Logon Process: ÈùÄ
Authentication Package: NTLM
Workstation Name: boxname
Status code: 0xC000006D
Substatus code: 0x0
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: 127.0.0.1
Source Port: 1476
I used Process Monitor and Fiddler to investigate but to no avail.
Why would this work for 3rd party browsers but not with IE or System.Net.WebClient?
I have seen a similar issue, where the Integrated / NTLM security will only work if you are accessing the host by machine name or localhost. In fact, it is a [poorly] document feature in Windows that is designed to protect against "reflection attacks".
Basically, you need to create a registry key on the machine that is trying to access the server, and whitelist the domain you are trying to hit. Each host name / FQDN needs to be on it's own line - there are no wildcards and the name must match exactly. From the KB Article:
Click Start, click Run, type regedit, and then click OK.
In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
Right-click MSV1_0, point to New, and then click Multi-String Value.
Type BackConnectionHostNames, and then press ENTER.
Right-click BackConnectionHostNames, and then click Modify.
In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
Exit Registry Editor, and then restart the computer.
http://support.microsoft.com/kb/956158/en-us
Have you tried ...
new NetworkCredential( "peter", "password", "boxname" );
You might also try ...
var credCache = new CredentialCache();
credCache.Add( new Uri ("http://localhost/upload.aspx"),
"Negotiate",
new NetworkCredential("peter", "password", "boxname"));
wc.Credentials = credCache;
Also, according to this it may be that IIS is configured wrong. Try replacing "Negotiate" with "Basic" in the above and checking your IIS config for the website. There's also a bunch of possible causes here.
Try going into IE's options and explicitly add the site to the Intranet Zone. Then re-run the program. You should also not run the program from an administrator login. This may trigger the Enhanced Security Configuration for Internet Explorer.
It could explain why you can hit the site with Firefox and Opera, but not with IE or WebClient.
Without knowing your IIS deployment, and assuming that you have the correct authorization rules for upload set in IIS (e.g. the right allow* ACL's on the right dirs you are trying to upload content to, etc), first thing I would try is to set UseDefaultCredentials to true instead of explicitly set Credential. (Maybe you think you are accessing the server with the Credentials you are setting but that's not the case? That would be possible if this works.)
This is a very common scenario, so I would focus on IIS authorization rules for the directory in which you are trying to upload the file, the actual ACL's on that directory. For ex. is your site impersonating or not? if it is, then you have to have actual ACL's on that dir, otherwise whatever account app pool is running on.
I'm writing a very small app to create and test caml querys for sharepoint. While executing the GetListItems method I'm receiving the following exception;
System.Net.WebException: "The request failed with an empty response."
The service is located on a https address (ssl). I setup the service as follows;
result = new ListService.Lists();
result.Url = siteUrl;
result.Credentials = new NetworkCredential(txtUserName.Text, txtPassword.Text, txtDomain.Text);
I invoke the GetListItems() method as follows;
xmlResult = spList.GetListItems(listName, string.Empty, camlQuery, null, string.Empty, null, string.Empty);
I'm trying to find out why I'm getting the empty result message. I've also tried other methods (i.e. GetListCollection) but to no avail.
At first I thought that the problem might be the URL (http instead of https), but that is not the case. I even checked it with wireshark to make sure the right URL is used.
Did someone come accross this problem and how did you solve it?
OMG...! I've solved it after all. After posting this question, I tried to get hold of the wsdl the check the service itself. When I checked it via internet explorer all was ok. When I tried to add it as a reference in VS it went wrong. So something was not ok. Then it occured to me that there was a new login screen for our company network.
After some quick phonecalls I learned what the problem was; IT Services installed a ISA 2006 server and 'forgot' to tell me. The ISA server was blocking all trafic on the HTTPS port (443) for unkown programs and or clients. That's why internet explorer presented me with a new and shiny login dialog.