I followed the first answer of How can I send email using Gmail SMTP in asp.net mvc application? and i tried another tutorials but same result(i used my gmail account and password). I receive error when it is doing smtp.Send(message); I receive error 502 ( Bad GateWay)
There are two forms of SMTP over SSL; Explicit SSL and Implicit SSL. You need to determine which form of SSL your destination server is using, and make sure that the SMTP library you are using supports that protocol and is configured properly.
I would also suggest that instead of sending email directly within your ASP.Net code, that you queue the messages to a database, and have a service that routinely checks the queue and sends messages, and only removes messages upon successful send.
Related
Presently I use VisualBasic .NET web app (with SendGrid for email) running on my Azure server VM. I receives SMTP email from public Internet directly to the VM ok. It send email using SendGrid addon ok.
Will this all work if I switch to Azure Web App (formerly Web Site)?
Should my web app code work as-is without modification, even the SendGrid calls?
Outgoing email using SendGrid will not be a problem at all. Using it on App Service is common and you probably don't need to change any code at all.
Inbound may require changes depending on what you're doing. Are you simply polling a mailbox somewhere else and then doing something with the messages? If so, you could convert that to a scheduled WebJob poll at a specific interval and act on incoming messages.
If you're running an SMTP server on your VM to receive mail, then that's something you cannot easily replicate on App Service.
I'm looking for a way to support the following process:
Button is clicked in web application running on machine named PC1234.
Call is made to server (either the web server or an API on another server, it doesn't matter) to Do Something.
The server sends a notification to a Windows Forms client installed on PC1234 that the action is complete.
I've got the easy part working using SignalR. I can call a method on the web server and then send a notification with SignalR to ALL clients that the method has completed. The problem is notifying ONLY the client on the originating machine.
My initial plan was to include some unique identifying attribute of the machine with the call to the server which could then be used to direct the SignalR notification back to just that machine, but that doesn't seem to be possible.
An alternative idea was to have the call to the server include a unique reference and also update a file locally (i.e. a Cookie) with that reference, then have the client app poll the Cookie for new references and filter all SignalR messages received for that unique reference. This would be a bit clunky even if it worked, which it doesn't really, not least because I want this to work cross-browser, and different browsers store cookies in different places.
Ultimately this is to support printing locally and silently from a web application. The user selects a document in the web application, hits a print button, the request is sent to the server which retrieves the document from the database, saves it to a network share and sends a notification to a client app on the machine from which the print request was generated. The client app then prints the document from the network share and deletes it.
I never found a way to do exactly what I described in my question, but I came up with an alternative which worked well enough.
In both my web application and my Windows Forms client, the user was logged in with the same Windows credentials. I was therefore able to have the server respond to the button click in the web application by broadcasting a SignalR message to all SignalR clients where the same user was logged in, using
Clients.User(userId).send(message)
See this article for more detailed examples and instructions.
In my Windows Forms client, I included code to track how many instances of the client were connected to the SignalR Hub with the same user credentials and code to handle the receipt of a SignalR message from the server when multiple client instances were connected with the same user details (in my case, this meant displaying a message saying something like "You've requested a print from the web application but you're logged in at multiple workstations. Do you want the document to print here?").
How to send a mail from non existing mail? Example: no-reply#mydomain.com using Spring Mail Sender Configuration. A mail doesn't exists so that reply to email address should fail.
Solution with java mail also preferred.
I tried with this too. It is not working with spring framework.
(Unknown Sender) when sending email with pdf attachment created in iText from java application
no-reply#mydomain.com
If you're not using SMTP authentication then it doesn't matter whether the email exists or not.
You can send email from addresses that doesn't exist without using SMTP authentication but that's usually a bad practice because such email's are usually evaluated as spam by most of the spam filters.
See this answer for more details.
Hence it's best practice to send email using SMTP authentication. But when sending email using that way you should have all credentials like email, password, outgoing server, port etc... and so you'll need a email that does exists.
I'm using the smtpclient class to send email from my asp.net website hosted on Azure in the 'shared' setup. Everywhere it says that port 25, and ALL ports are open on the Azure servers. My code works from my onw pc, but when published on Azure, it breaks. I am using gmail port 587 secure smpt and I get the error System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Any ways to get around this? (Without installing a vm with Exchange on it, like ocme on, it's a simple email message).
You are getting that error because of these two possible reasons:
You are using the SMTPClient of Gmail and you are passing the EmailId of some other website like Yahoo/Hotmail etc.
EmailId you are using is not authenticated, you need to provide your mobile number to authenticate your Email Id.
If you are using Yahoo/Hotmail then you can refer to this article which I had created on http://www.c-sharpcorner.com/
http://www.c-sharpcorner.com/UploadFile/cd7c2e/send-bulk-email-from-yahoo-and-hotmail-using-Asp-Net/
I added an HTTP Authorization Manager to JMeter, an HTTP Request Default and an HTTP Proxy Server.
I configured my HTTP Authorization Manager control Panel as:
Base URL: http://www.gmail.com
Username: abc
Password: xxxxxxx
But I am getting error in internet explorer when I open http://gmail.com
Error:
There is a problem with this website's security certificate.
The security certificate presented by this website was not issued by a trusted certificate authority. The security certificate presented by this website was issued for a different website's address.
Security certificate problems may indicate an attempt to fool you or
intercept any data you send to the server.
Can anybody tell me what I am missing or doing wrong?
Thanks in advance.
What are you trying to achieve? Are you trying to log in to gmail to read emails via Jmeter?
If so, it's not as easy as pointing to the gmail URL and using BASIC authentication. You could get an idea of what's involved by using BadBoy to record the actions you want to do and then export it to Jmeter.
That said, this is not a good approach.
I'd be looking at using the POP3 interface - trying to simulate a browser with Jmeter for a site like gmail which changes every day could be very difficult. It should be possible to write a Java POP3 client (or better yet, find an open source one) and call it from your Jmeter script.