System.Net.Mail.SmtpException : The operation has timed out - smtp

I have developed an mvc 5 application from which I'm sending e-mail using smtp. Before sending email I have to export pdf reports in a folder and than attach those reports with email. When I'm sending single email than no problems occur but when I'm sending 2000 or above emails with attaching pdf reports than at a certain time exporting stopped and no email is sending from the application. When I tried to catch the exception I found following exception thrown :
System.Net.Mail.SmtpException : The operation has timed out
Can anyone please help me regarding this issue.
With Regards

Sending a single mail will go very fast, but sending 2000 mails might take time, especially when sending files in each mail
set the timeout higher since there is much more data to process:
smtpClient.Timeout = 5000000;

Related

Send email from web to server using PHPMailer SMTP protocol

Hi I'm newbie here and i have a simple php form and when user submit it the data will be insert in database and email is send to user using PHPMailer; now mine question is that if i send two consecutively emails that have time difference of 1 minute then why their receiving time difference to user is 15 minutes.
Code will be provided on request.
Thanks.
Might be because of server delay are you using a shared server or maybe you mailer is miss confined

Working on incoming emails with SSIS

We are quite successful in using SSIS for sending out email notifications. On the other hand, we are missing an Email Source Adapter.
Assume the following situation: we receive mail with standardized Attachments. (e.g. Excel) We would like to have SSIS run over the (POP or IMAP) mailbox and analyze emails and attachments.
Has anybody seen such an adaptor? No matter if commercial or open source.

Does every SMTP server that can receive mail have to be able to send failure notices?

I am thinking about implementing my own SMTP server that can receive mail and store it. As this is a small hobby project, I'd prefer to keep the code simple – so, for example, I don't want to implement logic for sending mail. However, the following section from RFC 5321 makes me worry:
The server must give special treatment to cases in which the
processing following the end of mail data indication is only
partially successful. This could happen if, after accepting several
recipients and the mail data, the SMTP server finds that the mail
data could be successfully delivered to some, but not all, of the
recipients. In such cases, the response to the DATA command MUST be
an OK reply. However, the SMTP server MUST compose and send an
"undeliverable mail" notification message to the originator of the
message.
Does this mean that, even if I normally only return 250 OK when I'm sure the message has been stored safely, I am forced to implement stuff for sending failure notices just in case someone decides to send a mail to both an existing and a non-existing mail address at the same time? Is there any way to get around it without violating the standard? If there isn't, how bad would it be to just send back 452 Too many recipients (my RCPT limit is 1, not 100 as required by RFC 5321) whenever someone tries to send a mail to multiple recipients?
In such cases, the response to the DATA command MUST be an OK reply.
However, the SMTP server MUST compose and send an "undeliverable mail"
notification message to the originator of the message.
That seems rather unambiguous to me. If you are to be standards-compliant, you MUST both return an OK response (because the message could be delivered to some recipients) and send failure notification to the originator (because it could not be delivered to other recipients).
On the other hand, your question also mentioned that you will only accept delivery for a single recipient, so a) you've already resigned yourself to not being standards-compliant anyhow by not allowing 100 recipients and b) the failure mode of "mail data could be successfully delivered to some, but not all, of the recipients" will not be possible if there can only be a single recipient.
After re-thinking the situation, I think that it's actually possible to do this in an RFC-compliant way if the server can assure that the mail can be delivered to all recipients at RCPT command time – after all, individual recipients can be rejected when the corresponding RCPT command was received. Of course, this means that the server e.g. has to ensure that enough harddisk space is available for each recipient and the maximum mail size. And a server could just deny mail to a recipient if his current mailbox size plus the maximum mail size is more than the maximum mailbox size.
Of course, the actual implementation is a bit more complicated in order to support concurrency.

Amazon SES sending duplicate emails

I have switched to using Amazon SES to send our transactional alerts from our asp.net system and I'm getting calls that people are receiving duplicate emails.
I have confirmed that our program is only sending the email once to each user.
I received one of these duplicates exactly 5 minutes after the first email was sent, making me think it is some sort of retry issue.
Is there a way to configure/fix this issue?
If it makes any difference, I am using the AWS SDK in asp.net and calling the AmazonSimpleEmailServiceClient.SendEmail call.
Amazon assigns a unique message ID to every email sent. Look in the full headers of the emails you received for an ID like the following:
0000012fea2d8375-85e23920-10cf-4d1b-b237-5dc13847b66c-000000#email.amazonses.com
If it is the same in both emails you got, then there is some sort of glitch between Amazon and the receiving SMTP server that is causing it to be resent. If the ID is different between the 2 emails, then you are sending it twice.

Retrieve SMTP response of a mail

Is it possible to retrieve the SMTP response of a mail. For example, I am sending a mail to non existing email id. Surely our server will send us a mailer daemon failure mail to our mail id. I need to capture that failure mail.
How its possible? please explain me. Some time we may enter more than one non existing email id, so i have to retrieve all the failure mail alone for every corresponding emails
Please guide me!
Thanks in advance,
Praveen J
I think I understood your question correctly now. As I understand, you are writing an application to send mail. And in your application, whenever you send a mail, you also want verify that if mail was delivered and also if it was not delivered then you want to get hold of the failure message in your application. Is that how you mean?
Well, if that is how you mean, then I think it is impossible to track the mail status with your apllication code. For instance if you are using java sendMail in your apllication you can only ensure that the send happened from your code successfully(without any send exceptions like java.net.SocketException or javax.mail.MessagingException). But, you can never ensure if the mail really reached the recepient. i.e. you can never track in your application if the mail was rejected due to wrong recepient address or any other error like illegal attachment at receipient mail server or errors like blocked sender id etc.
That is because any such error condition will be communicated by the receipient mail server to the sending mail server the information of which is present in the sent mail's header.
Does that answer your question? (Or did I understand your question correctly? ;-))
I am not sure if I am getting your question right. If you send an email to any non existent address say xxx#gmail.com from your address yyy#yourhost.com, the mail server at gmail.com replies to the mail server at yourhost.com with failure message and reason, with your delivery address and you receive the fialure mail automatically. you don't have to do anything extra in this.
If you are talking about seeing mail headers, then it depends on which client you are using. For instace, if you are using MS outlook, you can right-click on the message and click options and then see internet headers section to get mail headers. If you are using some web based mail then i am sure there will some option to view detailed mail headers.
The bounced messages are going to return to a mailbox. You should be able to configure that mailbox by properly setting the headers on the messages you send out. You would then need to monitor that mailbox, or have that mailbox deliver the messages to your program.
I would suggest you consider using VERP for all messages you send out. It will make it much easier for you to identify which email address a particular bounce belongs too. To do this you would need control of your mail server though. It takes some work configuring things.
To answer the question with more detail you need to tell us how your are sending messages, what type of mail server you are running, and how much control you have over the mail server.
On Unix, you can use "procmail" for this. Procmail is a service which can intercept your mails and process them following rules.
If you can access your mail my IMAP, I suggest to look at the Python module imaplib.