@@ -183,11 +183,6 @@ internal static void SendBindingErrorReport()
183
183
184
184
bindingErrorTask . Wait ( ) ; errorLogTask . Wait ( ) ;
185
185
186
- if ( ( bindingErrorTask . IsCompleted && errorLogTask . IsCompleted ) && File . Exists ( "ErrorLogReport.xlsx" ) || File . Exists ( "BindingErrorReport.xlsx" ) )
187
- {
188
- SendAutomationStartedMail ( ) ;
189
- }
190
-
191
186
foreach ( var deleteFile in files )
192
187
{
193
188
if ( deleteFile . Name . Contains ( "LiveDemos" ) || deleteFile . Name . Contains ( "BindingError" ) )
@@ -199,80 +194,5 @@ internal static void SendBindingErrorReport()
199
194
}
200
195
}
201
196
}
202
- private static void SendAutomationStartedMail ( )
203
- {
204
- IPHostEntry host ;
205
- string name = System . Net . Dns . GetHostName ( ) ;
206
- host = System . Net . Dns . GetHostEntry ( name ) ;
207
- System . Net . IPAddress ip = host . AddressList . Where ( n => n . AddressFamily == System . Net . Sockets . AddressFamily . InterNetwork ) . First ( ) ;
208
- List < string > message = new List < string > ( ) ;
209
- string htmlBody = GetBody ( ip ) ;
210
- AlternateView avHtml = AlternateView . CreateAlternateViewFromString ( htmlBody , null , MediaTypeNames . Text . Html ) ;
211
- MailMessage myMessage = new MailMessage ( ) ;
212
- myMessage . AlternateViews . Add ( avHtml ) ;
213
- myMessage . IsBodyHtml = true ;
214
- myMessage . Body = htmlBody ;
215
- myMessage . From = new MailAddress ( "[email protected] " ) ;
216
-
217
-
218
- for ( int i = 0 ; i < Receivers . Count ( ) ; i ++ )
219
- {
220
- myMessage . To . Add ( new MailAddress ( Receivers [ i ] ) ) ;
221
- }
222
- myMessage . Priority = MailPriority . High ;
223
- myMessage . Subject = String . Format ( "Binding error report details" ) ;
224
- string errorPath = Directory . GetCurrentDirectory ( ) + @"\ErrorLogReport.xlsx" ;
225
- string bindingErrorPath = Directory . GetCurrentDirectory ( ) + @"\BindingErrorReport.xlsx" ;
226
- if ( File . Exists ( bindingErrorPath ) )
227
- {
228
- System . Net . Mail . Attachment bindingError = new System . Net . Mail . Attachment ( bindingErrorPath ) ;
229
- myMessage . Attachments . Add ( bindingError ) ;
230
- }
231
- if ( File . Exists ( errorPath ) )
232
- {
233
- System . Net . Mail . Attachment errorList = new System . Net . Mail . Attachment ( errorPath ) ;
234
- myMessage . Attachments . Add ( errorList ) ;
235
- }
236
- SmtpClient client = new SmtpClient ( "smtp.office365.com" , 587 ) ;
237
- client . EnableSsl = true ;
238
- client . UseDefaultCredentials = false ;
239
- var secure = new SecureString ( ) ;
240
- string password = "rlpfgshzxwwgrbhg" ;
241
- foreach ( char c in password )
242
- {
243
- secure . AppendChar ( c ) ;
244
- }
245
- client . Credentials = new NetworkCredential ( "[email protected] " , secure ) ;
246
- int count = 0 ;
247
- while ( count < 3 )
248
- {
249
- try
250
- {
251
- client . Send ( myMessage ) ;
252
- message . Add ( "Automation status has been sent..." ) ;
253
- count = 3 ;
254
- }
255
- catch ( Exception ex )
256
- {
257
- message . Add ( ex . Message ) ;
258
- message . Add ( String . Format ( "Sending Mail Attemp - {0}" , count . ToString ( ) ) ) ;
259
- Thread . Sleep ( 60000 ) ;
260
- count ++ ;
261
- }
262
- }
263
- }
264
-
265
- /// <summary>
266
- /// Generates the email content for build failed
267
- /// </summary>
268
- /// <returns></returns>
269
- private static string GetBody ( IPAddress ip )
270
- {
271
- StringBuilder sb = new StringBuilder ( ) ;
272
- sb . Append ( "<html bgcolor='#F6F6F6'><p>Hi Team,<br><br>Please find binding error, live demos and error report details from the attachment. </p>" ) ;
273
- sb . Append ( "<br>Thanks,<br><br>" ) ;
274
- sb . Append ( "Tools Docking Team<br>Syncfusion Software.</html>" ) ;
275
- return sb . ToString ( ) ;
276
- }
277
197
}
278
198
}
0 commit comments