Receiving emails in asp.net - asp.net

I am looking into an application that needs to check that emails are being sent and received. Using asp.net to send emails is easy and not a problem, but putting in the processes to enable code to wait for and verify incoming emails is not supported.
So the best solution we have come up with is to use a COM connection to a Lotus mail client ( which is what the client use ) and process it in that way. But it struck me that this is a bit of a hack together.
So is there a way of using an SMTP server and asp.net code to look at emails and verify them coming into a specific email address?

SMTP is used for sending e-mail.
You need to hook into a POP3, IMAP or Exchange server to monitor for received messages.
Can you explain some more about the process that you're trying to automate? Are you trying to detect invalid e-mail addresses? If so, you can monitor a mailbox associated with the sending user for 'bounce' messages.

You can access a pop email direct with code using a library such as:
http://sourceforge.net/projects/hpop/
We did this in conjuction with email blasts so we could monitor the mailbox for bounce backs.

Related

How do i send mail over IMAP in R

I looked up sending mail in R and found that the libarary SendMailR can be used for smpt but does not seem to have any IMAP related options.
An example of what I've found so far.
how do you send email from R
You are confused. Mail flows in two ways:
To you -- that is IMAP, POP, ... and you do not send that way but receive.
From you -- that is SMTP and you (generally) need to interact with a mail-sending program like sendmail, exim, qmail, ... or the smtp service offered by the Google GMail back end. As I recall, SendMailR can deal with these.
So in short, _there is no sending via IMAP. (Check eg the advanced email setup options of your smartphone. They generally split it between receiving -- my point 1. above -- and sending as in point 2.)
The simplest way to send then depends on your operating system. These details matter.

How to subscribe to messages created in a BizTalk orchestration?

I have an orchestration that takes a message. The target namespace is "http://microsoft.com/HealthCare/HL7/2X" and the root element is "ORU_R01_23_GLO_DEF"
In the orchestration, I map the message to an intermediate message type in a construct shape. The target namespace is "http://mycompany.com/myapplication" and the root element is "MyMessage". The "MyMessage" message is then further mapped and then sent to a web service using a logical send port in the orchestration. A WCF send port is then bound to the orchestration and everything works fine. Everything works as expected.
Without altering the orchestration, I want to create a send port that subscribes to the intermediate "MyMessage" message and writes it to a file. To do this, I have created a send port with a filter of BTS.MessageType = http://mycompany.com/myapplication#MyMessage.
Even though messages are flowing through the orchestration, my send port isn't picking up the message. Is this the incorrect filter to use?
Are you trying to subscribe to the 'MyMessage' message, or the same message that is sent to the logical Send Port bound to the physical WCF Send Port?
You have stated that:
The "MyMessage" message is then further mapped and then sent to a web service using a logical send port in the orchestration. A WCF send port is then bound to the orchestration and everything works fine.
Message not Published to MsgBox
From what you have described, I would suggest that you do not have a Send Shape/Logical Send Port combination in your orchestration for the 'MyMessage' message, which is why you can't manually subscribe to this message type in a Send Port filter. The fact that you have not mentioned a 'Failed Routing Report' message further suggests that this is the case - this message type is generated when no subscriotion can be found for a message that is to be published to the MsgBox.
Capture a Message's 'MessageType'
If however you need to capture a copy of the message your are sending over the WCF Send Port, you will need to determine its MessageType and use that in your second Send Port subscription that writes the message out to file.
If you are unsure as to what MessageType to use, there is a simple trick to determine this information:
Stop (not Unenlist) the WCF Send Port
Send a message through your orchestration as normal - the message will be marked as 'Suspended Resumable' in the BizTalk Admin Console on the WCF Send Port.
Open the message in the BizTalk Admin Console and view its 'Message Context'; in the Message Context you will see its 'MessageType' property which you can then use to understand which subscription filter to use.
Start the WCF Send Port to flush the message.
Alternatively, if you don't want to change your orchestration, you could try archiving your message as it passes through the Send Pipeline in the (original) WCF Send Port - either write your own archiving component or use an existing commercial component. By using an archiving component in this manner, you will save yourself the expense of an extra subscription and the associated Send Port maintenance.
Update:
It sounds very much like the OP is not sending the intermediate message to the Message Box from their Orchestration (see comments). Message subscription will only work when a message is published to the Message Box - in this case, the message in question ('Message B') is an intermediate message that only lives within the context & lifetime of the orchestration. The OP needs to Send the message to a Direct Bound port within the Orchestration to allow the message to be subscribed to via a Send Port.
Verify the pipelines of the Send Port. Should by XML, not Passthrougth.

Send message to everyone connected to LAN

I want to send a message to everyone(broadcast) in my subnet(LAN) so as to prevent them using Internet due to repair work that's going to happen. How do i do that ? I can't use "wall" because no one is logged on some server.
I want to send a packet that opens a new Tab in web browser and displays message that stop using Internet during a certain duration.
http://en.wikipedia.org/wiki/ARP_spoofing
You might be interested in something like this. I am not sure if this will work in your LAN environment, but typically it should mess up with the entire LAN :D
you can use sockets to send a message to everyone connected in LAN, you can use java and when you want send a message to all clients, every client will see a msgbox with the information you want display....
net send command will be helpful in windows machines. Im not sure about linux.
Plz refer the following link for more Info.
http://www.cezeo.com/tips-and-tricks/net-send-command/
This is a solution shared by my senior( Hope it helps anyone who views this post). What we can do is to do DNS spoofing and redirect everyone's request to a server where you can show the required message.

SmtpClient.Send Exception

My site sends confirmation emails from a purchase. 95% of the time, it works. The other 5% after clicking the 'Confirm' button that runs the payment and should send the email, i get the following exception:
Details:
Exception: Failure sending mail.
Inner Exception: Unable to connect to
the remote server
Inner Exception
(2): A connection attempt failed
because the connected party did not
properly respond after a period of
time, or established connection failed
because connected host has failed to
respond 72.167.234.197:25
The code to send the email is this:
Dim smtpClientPayPalSuccess As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()
smtpClientPayPalSuccess.Host = "relay-hosting.secureserver.net"
smtpClientPayPalSuccess.Send(mailMessagePayPalSuccess)
FYI: I have confirmed with the hosting that I don't need any credentials, or a different port number than 25. This is also running over https.
Any idea why this would be happening only a small percentage of the time?
Thanks.
Dave
I don't know why the mail fails part of the time. As far as I know it could be scheduled maintenance of the firewalls or the mail server itself.
I would advise you to send the mail asynchronously, and not as part of the 'Confirm' button process. Just put the mail on a (persistent) store and keep trying to send it with some time in between.
Alternatively (and heartily recommended) is to send the mail from your app to a local mail server, and let that mail server forward the mail to 72.167.234.197:25. That way you get the retries for free and the chance that sending mail to localhost fails is quite small (or it should be small).
It is possible and quite likely based on your exposition, that there are actual network errors that prevent your site from connecting/communicating with the SMTP server. This could be the result of too much traffic, or maybe slow network connections. My recommendation would be to put a try/catch around the emailing code, and maybe retry sending the e-mail a few times before giving up.
When you mention that this is working 95% of the time it shows that the problem most likely lies outside of your control.
As a side note, you should maybe consider not giving up the actual IP address of your SMTP server (it is of no consequence to the question)

Sending an SMS Message with ASP.NET

how do i send an sms message from my web application using asp.net with c#.
You cant send messages directly through asp.net.
What you can do is send a web request or an email to an online SMS provider,
or to a local gateway (like a phone) and it can then pass the message onto
the GSM network.
Try Clickatell to get an idea of what I mean.
http://www.clickatell.com/brochure/coverage.php
If you don't want to pay, most cell phone carriers have an email that you can send messages to that will then forward them to the proper recipient. E.G. (10 digit phone number)#txt.att.net.
Bu of course this means that you will have to know the carrier, and many of them will not send outside the U.S. so that might not be the most attractive option.
You find a gateway (I use Clickatell, but there are others) and integrate with them. It's generally quite trivial (but of course, you pay to send the messages). They often have SMTP, HTTP and other types of APIs.

Resources