w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Winsock - wait with calling accept() until client is really trying to connect
As you're using Winsock, you could use the Microsoft-specific extension function AcceptEx. This allows you to perform the accept as "Overlapped I/O", which conceptually means that the accept runs in the background, and you can occasionally go in and check if it's happened or not, either by checking the OverlappedResult, or by performing a Wait on the OverlappedHandle. AcceptEx will also optionally perform the first receive. Without writing all of the code and thoroughly testing it, something like the following should work: // The following: // Has no error checking // Assumes sListen is a bound listening socket // Some other assumptions I've not listed :) // Allocate space to store the two sockaddr's that AcceptEx will give you // char lpOutputBuffer[sizeof((sockaddr_in)+16) * 2]

Categories : C++

postfix; pipe mail content to script for all mail of specific subdomain
It seems i solved the mystery problem. When i create an alias myself from test@example.com to test@vacation.example.com, the script gets called. mail.log Jul 12 15:20:55 mail postfix/pipe[14843]: 8854BB80B07: to=<test@vacation.example.com>, relay=vacation, delay=0.19, delays=0.07/0/0/0.12, dsn=2.0.0, status=sent (delivered via vacation service) vacation.pl logfile: 2013/07/12 15:21:27 DEBUG> /var/spool/vacation/vacation.pl:550 main:: - Script argument SMTP recipient is : 'test@vacation.example.com' and smtp_sender : 'peter@example.org' 2013/07/12 15:21:27 DEBUG> /var/spool/vacation/vacation.pl:580 main:: - Converted autoreply mailbox back to normal style - from test@vacation.example.com to test 2013/07/12 15:21:27 DEBUG> /var/spool/vacation/vacation.pl:590 main:: - Emai

Categories : Misc

postfix 2.9.6.1 forward all mail to an external mail address
Finally found the answer. Listing here for posterity. Add the folowing line to the end of your main.cf file vi /etc/postfix/main.cf virtual_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regexp Create a file which lists the mail address you want all mails to be sent to vi /etc/postfix/virtual-regexp Add the following: /.+@.+/ forwardingmailaddress@gmail.com add it to postmap postmap /etc/postfix/virtual-regexp you will need to add a virtual file. touch /etc/postfix/virtual now add it to postmap postmap /etc/postfix/virtual

Categories : Ubuntu

Send mail using php and postfix
PHP runs on the server. onClick executes Javascript on the CLIENT machine. You can NOT directly invoke PHP functions via Javascript code, or vice versa. What you're doing can be accomplished with a simple form: <?php if ($_SERVER["REQUEST_METHOD"] == 'POST') { $to = $_POST['to']; $text = $_POST['text']; mail($to, .....); } ?> <form method="POST" action=""> <input type="text" name="to" /> <input type="text" name="text" /> <input type="submit" /> </form> There is no need to use Javascript at all.

Categories : PHP

"Unhandled Error" comes when TCP server tries to accept connections from client in twisted
class ChatServer(Protocol): def connectionMade(self): print("A Client Has Connected") factory = Factory() reactor.listenTCP(80,factory) You haven't made any association between factory and ChatServer in this code. Try inserting this line: factory.protocol = ChatServer In an upcoming (not yet released) version of Twisted, Factory is getting a new class method to make this set-up even easier. Using that version, this example would be even shorter: class ChatServer(Protocol): def connectionMade(self): print("A Client Has Connected") reactor.listenTCP(80, Factory.forProtocol(ChatServer))

Categories : Python

Postfix sending mail from nonexistent email addresses
The reject_unlisted_sender restriction listed in smtpd_sender_restrictions is listed after permit_mynetworks and permit_sasl_authenticated. Postfix traverses the restriction list in order and terminates when it hits the first permit/reject and hence never reaches reject_unlisted_sender. Since your message wasn't rejected by reject_unauth_destination it must've been accepted because of permit_mynetworks or permit_sasl_authenticated. Additionally, unless the sender address you used had a domain part that was actually "owned" by Postfix (i.e. listed in mydestination, virtual_mailbox_domains, virtual_alias_domains, or relay_domains), it can't be validated and reject_unlisted_sender won't work. See details in the postconf(5) man page. Other observations: The warn_if_reject restriction is pl

Categories : Mysql

unable to semd 1000 mail from cakephp to centos(postfix/covedot)
I'd say this is probably due to the php script taking too long to execute. One solution is to send the emails using BCC but this isn't always an option if you are trying to track emails. You might try sending using a less memory intensive way. What is your current Configemail.php

Categories : Cakephp

Upgrade Ubuntu -> Now Postfix, Connect failed to database
Let's be more specific on localhost connections: I can't telnet MySQL on my localhost. MySQL is up and running and works fine with Apache-SSL/PHP/MySQL server but I can't connect by telnet: telnet 127.0.0.1 3306 Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection timed out The same for localhost telnet localhost 3306 Trying 127.0.0.1... Trying ::1... telnet: Unable to connect to remote host: Connection timed out Netstat confirms MySQL is running on 3306 port: netstat -alpent | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 105 522804419 17231/mysqld tcp 0 1 127.0.0.1:39268 127.0.0.1:3306 SYN_SENT 0 522915717 17433/auth tcp 0 1 127.0.0.1:39254 127.0.

Categories : Mysql

Default mail client continues to be running in background after mail is sent
Ok finally figured out the solution. The problem is, am using Application#Context to start the activity. When ever we use Application#Context a new Task is created ( that's why, adding the flag Intent.FLAG_ACTIVITY_NEW_TASK in the intent if we don't add this Flag then app crashes) . To avoid creation of new task all we need to do is use the right context ie., use the activities context. ("Be careful and avoid memory leaks in case storing the activity context reference"). So the code is as below Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_SUBJECT, "Report issue: ""+mIssueTitle+"""); intent.putExtra(Intent.EXTRA_TEXT, mailBody); String[] mailIds = new String[] {getReportingMailId()}; intent.putExtra(Intent.EXTRA_EM

Categories : Android

Java send mail automatically with local mail client
The answer is Java Mail API. Basically, you need a mail account (usually username+password), you also need the mail SP's SMTP server address, which is usually on their website.

Categories : Java

Client.Error.MessageSend - Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url:
HTTP: Status 404 clearly means the server is not able to find the page you're looking for. The URL you're using is invalid. http://localhost:8080/demo/spring/messagebroker/amf Maybe you are missing a trailing slash or something. For the list of HTTP error codes: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error

Categories : Java

Error debugging code in visual studio 2012 - Failed to initialize client proxy: could not connect to
It looks like this happens sometimes when the VS execution engine process is terminated. This was the case for me, since I had terminated the process manually when the process was not responding. You could check if you have "vstest.executionengine.exe" process running when you see this error message. I came across this solution at the MS forum below: Reference: http://social.msdn.microsoft.com/Forums/vstudio/en-US/997291d8-03e4-47ed-a30d-9d47550c0094/cannot-connect-to-the-testexecutor-via-named-pipes-from-vs-2012-rc

Categories : Dotnet

ZeroMQ, Client<-> Server , bi-directional communication possible with only having the client connect to host?
For connecting to the server, you need a DEALER socket on the client side, and a ROUTER socket on the server. Because you need a publish subscribe pattern you will need a SUB socket on the client side, and a PUB socket on the server side. Client Server +-------+ +--------+ | Dealer| <--> | Router | | Sub | <-- | Pub | +-------+ +--------+ So you bind the Router and the Pub sockets, and connect the Dealer, and the Sub sockets. Than when you want to: Publish Messages (no reply expected): Create an envelope ( pub, channel, message ) and send it through the Dealer, on the Router side the router will receive the following envelope ( dealer, pub, channel, message ), so you can publish the message on channel through PUB socket. Receive Messages (no reply exp

Categories : C#

Python: Socket Programming: accept() and connect calls
Your trial - accepting once and then receiving multiple messages - is how you should do this. Calling accept is waiting for a new connection - you don't need to do this every time you want to send or receive a message, just as you don't want to call connect every time you want to send or receive. Think of it this way: When you connect to a chat server, do you connect, send a message, then disconnect immediately? No - you have a constant open connection which messages are sent through, and the connection is only closed at the end of a chat session. From the docs on accept: socket.accept() Accept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and

Categories : Python

Java Mail: Only one part of the message is retrieved / Parsing error / Badly formatted mail
JavaMail debugging tips are here. You can get the entire message text using the Message.writeTo method. Write it to a FileOutputStream or a ByteArrayOutputStream. You might have better luck using the JavaMail reference implementation instead of the Geronimo(?) version you're using.

Categories : Java

why won't my client side accept anymore input
Just a quick look at the code, I see the client waits for 2 lines: System.out.println(in.readLine()); System.out.println(in.readLine()); and the server sends only 1: out.println(outputLine); May be that is the problem. I'd also will enclose the reading part of the client in a try ... catch ... finally block, like this: try { while (true) { System.out.print("input: "); userInput = stdIn.readLine(); if (userInput == null) break; out.println(userInput); System.out.println(in.readLine()); System.out.println(in.readLine()); if (userInput.equals("Bye.")) { System.out.println("Exit program"); break; } getValueLog(parseFixMsg(userInput,userInput)); } } catch (Exception e) { e.printStackTrace();

Categories : Java

gsoap Server does not accept Client request
The service endpoint may not be set to your server, but to whatever the WSDL defines as the server address. You should use EnrollmentServiceSOAPProxy proxy("URL"); with the URL that is your server's endpoint address (http://hostaddr or http://localhost:8000 when you run your server local on port 8000).

Categories : Misc

Invalid Addresses; nested exception is:com.sun.mail.smtp.SMTPAddressFailedException: 501 5.5.2 RCPT TO syntax error (When i try to send mail)
See this list of common JavaMail mistakes. Turn on JavaMail session debugging and post the protocol trace so we can see exactly what the server is complaining about. Most likely there's something wrong with one of the addresses you're using.

Categories : Java

Optionally accept client certificates in a self-hosted WCF service
I think that does not work. If you cannot influence the client so that an empty certificate is created or an unassigned reference to a certificate is accepted, validate the this special case from the server side and log to a log file then there is no way. You will have to mimic IIS behavior and you will have to check before. That's a guess. No expertise. What you do usually is to a) try to validate the certificate by walking through the chain for certificates provided b) In case of no certificate provided double and triple check the client and log the occurrence. I think '.net' does not give you the opportunity to control the negotiation. Imo that opens the door to the man in the middle. That's why I think MS don't allow that and Java similar, afik. Finally I decided put the service b

Categories : Wcf

How to set accept media type in RestTemplate (Spring restful client)
If the Rest Service is producing only XML, then I don't think you will be able to accept it as JSON. In that case what you need to do is add the MediaType as "application/json" in the Rest Service, along with the existing xml response. For e.g in Spring Restful Service the annotation would be @RequestMapping(value = "/myurl", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) If the Rest Service is producing Json and Xml, then in the rest client you need to do : ResponseEntity<YourClass> apiResp = restTemplate.exchange(url, HttpMethod.GET, request, YourClass.class); YourClass output=apiResp.getBody();

Categories : Java

Infix to Postfix conversion error
It looks like you're using the Shunting-yard algorithm, but there are a few things you're doing incorrectly. First of all, after the meat of the algorithm runs you still have to print out the remaining contents of the stack and check for mismatched parens. As the wiki article says: When there are no more tokens to read While there are still operator tokens in the stack: If the operator token on the top of the stack is a parenthesis, then there are mismatched parentheses. Pop the operator onto the output queue. This is easy enough to add to your code, just add something like this after the for loop: while(!isempty(&s)) { ch = pop(&s); if(ch == ')' || ch == '(') { printf(" Mismatched parens "); break; } printf("%c",ch); } B

Categories : C

Why it the F postfix needed here to avoid an error?
Because floating point numbers are by default of type double. To make it a float you append an F. You are getting error in the below assignment: float f = 3.4028235E38; because a double as more precision than a float. So, there is a possible loss of precision. I would have expected just the opposite as floating point literals are by default double and should be more precise. Let's check the binary representation of your number till double precision: 0x47EFFFFFE54DAFF8 = 01000111 11101111 11111111 11111111 11100101 01001101 10101111 11111000 Now since float is a single precision 32-bit floating point value. It can't store all the double values, which are double precision 64-bit floating point values.

Categories : Java

Prioritizing text/html over other content types when client sends Accept: */*
One solution is to lower the fooJSON() priority by it's value parameter. In practice, the patterns /foo and /foo{1} are equivalent. The second one, though, is considered "more generic" and is used lastly: @Controller public class FooController { @RequestMapping(value="/foo", produces="text/html") public String fooHTML() { // ... } @RequestMapping(value="/foo{1}", produces="application/json") // ^^^------- changed here public String fooJSON() { // ... } } This way: text/html goes to fooHTML() application/json goes to fooJSON() */* goes to fooHTML() anything else yields a 406 - Not Acceptable error

Categories : Spring

unable to connect to remote server c# while sending mail
can you try shortening your code to something like the following var smptClient = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential("isavepluscom@gmail.com", "123456789"), EnableSsl = true }; smptClient.Send("isavepluscom@gmail.com", "test@gmail.com", "Testing Email", "testing the email");

Categories : C#

infix to postfix using stack error in updating top variable
in main function add these three lines after for loop End.and remove top=POP(stack,top); inside for loop. while(top!=-1) top=POP(stack,top); printf(" "); modified main function: int main() { char string[15],ch; int top=-1,i; printf("Enter the infix operation: "); gets(string); fflush(stdin); for(i=0;string[i]!='';i++) { ch=string[i]; if( ((ch>='a') && (ch<='z'))||((ch>='A') &&(ch<='Z')) ) { printf("%c",string[i]); } else { ch=string[i]; top=PUSH(stack,top,ch); } } while(top!=-1) top=POP(stack,top); printf(" "); return 0; }

Categories : C

mail sent by access url but SMTP Connect() failed when run with batch file
Remember that cron jobs will be using the PHP CLI. And the PHP CLI uses a different php.ini file to Apache. Make sure you have all the required extension activated within this other php.ini file. I would imagine the php_smtp extension is not activated. Ahh I see you are using WAMP so the PHP CLI version of the php.ini file will be in c:wampinphpphp5.x.yphp.ini. Where as the Apache version is in c:wampinapacheapache2.x.yinphp.ini if you need to compare which extension you have activated in Apache PHP to those not activated in the PHP CLI

Categories : PHP

spring2.5 javamailsender locked in javax.mail.service.connect
I think, it could also be because of the restriction placed by SMTP server. To prevent spamming, many SMTP servers allows a limited set of email sending within a given time range. In this case, the flow might simply be waiting and looks blocked. Check your SMTP admin for these restrictions.

Categories : Java

Client-Server Program: Client can connect to server easily but server can't respond cause target machine actively refuses connections
You need to design your client and server so that the client-to-server connection remains open to recieve the responce and then do something like this: public static bool sendTo(IPEndPoint ip, String data) { TcpClient client = null; NetworkStream stream = null; StreamWriter writer = null; StreamReader reader = null; try { client = new TcpClient(); client.Connect(ip); stream = c.GetStream(); writer = new StreamWriter(stream); writer.WriteLine(data); writer.Flush(); reader = new StreamReader(stream); string response = reader.ReadLine(); if (response == "roger-alpha-tango") { return true; } } catch { return false; } finally { i

Categories : C#

Using Delphi xe4, mail client will not open
No one responded. There was an easier way - using an action sheet to perform the same sharing functionality that we see in just about all Apple software products. It is located in an example in the Delphi Samples. You can send text, email, etc. etc. Also can attach pictures. Hint: The share feature functionality does not work in the simulator but does actually work on devices.

Categories : Iphone

persistent connection by mail client
The connection is not actually persistence. Whenever you authenticate to one of this mail clients it stores a persistent authentication cookie in your browser if you select remember me. This cookie holds your user information. As long as this cookie is valid web application doesn't prompt you for username and password. This cookie is deleted when log-out. You can learn more about cookie here.

Categories : Http

How to check the default mail client
There is no concept of a "default mail client on Android". There is a concept of a default app for a specific Intent structure. Hence, an Intent to send an email (e.g., ACTION_SENDTO with a mailto: Uri) may be tied to a default app. To find out what that default is, create the desired Intent and use resolveActivity() on PackageManager. This will come back with: The default app, if there is one A resolver activity (e.g., the system chooser), if there is no default and there is more than one choice The only email app, if there is only one choice null, if there are no matching activities Or, use PackageManager and getPreferredActivities() and sift through those for things that you think are mail clients.

Categories : Android

How to skip Invalid Email Ids in Postfix and prevent it from throwing error
You can activate/configure postfix ability of *address_verification* (see also http://www.postfix.org/ADDRESS_VERIFICATION_README.html) to block unknown sender.

Categories : Java

error in the given code for infix to postfix conversion for input containing more than 2 operands
Indent your code In the stack trace: at Test.convert(Test.java:21) Is this line: if(check(exp.charAt(i))>check(exp.charAt(i-1))) So I think you mean: if (check(exp.charAt(i)) > check(s1.peek())) Now "The method check(char) in the type Test is not applicable for the arguments (Object)" is raised, so parameterized your Stack. That is, change: Stack s1=new Stack(); To (in Java 7): Stack<Character> s1 = new Stack<>();

Categories : Java

javax.mail.MessagingException could not connect to SMTP host port :25 response -1
From the Java Mail API FAQ: You should call trans.sendMessage(msg, addrs) to send the message. As described above, the send method is a static convenience method that acquires its own Transport object and creates its own connection to use for sending; it does not use the connection associated with any Transport object through which it is invoked. In short, don't call Transport.send(...), call Transport.sendMessage(...) instead.

Categories : Java

Asp.net Mail Sending Client works on some, but not all computers?
This sounds like firewall problem (since this is case only on some machines) or maybe no internet connection avavilable on some laptops. Check this solution from stackoverflow (not related with firewall): C# - Failure sending mail

Categories : Asp Net

mailto: in URLs without a mail client installed
You can determine what executable/command handles the mailto: protocol with AssocQueryString("mailto") (or by looking in hkcrmailtoshellopencommand). If your lucky this will be empty for a machine with no association set.

Categories : C++

How do I open the default mail client and create an email?
Depending on the version of your mail client, try to add &attach="C:some_file.txt to the end of mailto:xxx@xxx.com. This should add an attachment when the mail client opens. If attach does not work, try attachment in stead. I wonder if you can't add both.

Categories : C#

Who will set the e-mail as read, SMTP server or email client?
SMTP stopped being involved when it delivered the message to the IMAP server. Typically, the IMAP server sets a message's flags to unread when it first arrives, and removes this flag when you fetch the message. In theory, a client could keep its own local per-message state independently from the server's, but for read / unread status, this doesn't make much sense. For other metainformation, this may be used as a mechanism for other kinds of message status; for example, Thunderbird's message tags do not appear to be saved on the server. Incidentally, there is a peek option in the IMAP protocol for examining a message without affecting its unread status.

Categories : Email

Connect failed (1006) msg: TB.socket error, Connect Time-out (1008)
The reason you are getting this error is that your iOS app is using OpenTok's flash stack and your website is using the WebRTC stack. OpenTok's flash and Webrtc services are not interoperable and you would need to stick to one. Your iOS is currently streaming to a flash media server. You website is trying to use WebRTC library, which is trying to establish a socket connection with the flash server, thus giving you the TB.Socket error. What you should do is to stick to one stack. OpenTok's webrtc JavaScript library with OpenTok webrtc iOS sdk OpenTok's flash JavaScript library with OpenTok flash iOS sdk Sometimes in Xcode, simply deleting the flash framework and dragging in the webrtc framework will not work. You would have to go to Project Navigator -> Project -> Build Settings -> F

Categories : Javascript

HTML layout is messed up in Microsoft Outlook E-mail client
You may need to do more research on html email design. It is not the same as html for the web and should be table based instead of divs. Here is a basic example of how your example code should look: <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#333333"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="left"> <a href=""><img style="margin: 0; border: 0; padding: 0; display: block;" src="MyLogo.png" width="30px" height="10px" alt="Logo"></a> </td> </tr> <tr> <td align="left" style="font-size:12px; padding-left: 2px; font-weight: bold; color:#DDDDDD;"> Comment

Categories : HTML



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.