Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send email through WPF application and marked as UnJunk
    primarykey
    data
    text
    <p>Hi im trying to send a notification email when event took a place, but the problem is the email marked as spam and listed in junk mail, How can avoid junk mail and send email direct to inbox :)</p> <p>Here is my code:</p> <pre><code> Function SendResignEmail(PF As String, User As String, First_Name As String, Last_Name As String, Unit As String, EndDate As Date, Reason As String, JMTS As String, EmailTo() As String, EmailCC() As String, EmailSub As String) Dim EmailBody As String = "&lt;!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'&gt;&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;head&gt;&lt;meta content='en-us' http-equiv='Content-Language' /&gt;&lt;meta content='text/html; charset=utf-8' http-equiv='Content-Type' /&gt;&lt;title&gt;Untitled 1&lt;/title&gt;&lt;style type='text/css'&gt; p.MsoNormal {margin-bottom:.0001pt; font-size:11.0pt; font-family:'Calibri','sans-serif'; margin-left: 0in; margin-right: 0in; margin-top: 0in;} table.MsoNormalTable {font-size:10.0pt; font-family:'Times New Roman','serif';}a:link {color:blue; text-decoration:underline; text-underline:single;}.auto-style1 { font-family: Arial, sans-serif; font-size: 10pt; color: #9B5F9B;}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;Dear team,&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;Kindly be informed that the below agent had resigned and his last working day is " &amp; EndDate.ToShortDateString &amp; " &lt;/span&gt;&lt;b&gt;&lt;span style='font-size:12.0pt;color:black'&gt;.&lt;/span&gt;&lt;/b&gt;&lt;span style='color:black'&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;table border='0' cellpadding='0' cellspacing='0' class='MsoNormalTable' style='width:491.55pt;margin-left:-1.15pt;border-collapse:collapse;mso-yfti-tbllook: 1184;mso-padding-alt:0in 0in 0in 0in' width='655'&gt; &lt;tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:15.75pt'&gt; &lt;td nowrap style='width: 48.0pt; border: solid windowtext 1.0pt; border-bottom: none; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='64'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;User&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width: 48.0pt; border-top: solid windowtext 1.0pt; border-left: none; border-bottom: none; border-right: solid windowtext 1.0pt; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='64'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;PF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width: 138.75pt; border-top: solid windowtext 1.0pt; border-left: none; border-bottom: none; border-right: solid windowtext 1.0pt; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='185'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width: 85.5pt; border-top: solid windowtext 1.0pt; border-left: none; border-bottom: none; border-right: solid windowtext 1.0pt; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='114'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;Area&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width: 43.05pt; border-top: solid windowtext 1.0pt; border-left: none; border-bottom: none; border-right: solid windowtext 1.0pt; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='57'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;End Date&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width: 70.2pt; border-top: solid windowtext 1.0pt; border-left: none; border-bottom: none; border-right: solid windowtext 1.0pt; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='94'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;Reason&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style='width: 58.05pt; border-top: solid windowtext 1.0pt; border-left: none; border-bottom: none; border-right: solid windowtext 1.0pt; background: #CCC0DA; padding: 0in 5.4pt 0in 5.4pt; height: 15.75pt' width='77'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;Mob #&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes;height:15.75pt'&gt; &lt;td nowrap style='width:48.0pt;border:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='64'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='font-size:9.0pt;font-family:&amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:black'&gt; 6303&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width:48.0pt;border:solid windowtext 1.0pt; border-left:none;padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='64'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='font-size:9.0pt;font-family:&amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:black'&gt; " &amp; PF &amp; "&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width:138.75pt;border:solid windowtext 1.0pt; border-left:none;padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='185'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;" &amp; First_Name &amp; " " &amp; Last_Name &amp; "&lt;/span&gt;&lt;span style='font-size:9.0pt; font-family:&amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:black'&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width:85.5pt;border:solid windowtext 1.0pt; border-left:none;padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='114'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;" &amp; Unit &amp; "&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width:43.05pt;border:solid windowtext 1.0pt; border-left:none;padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='57'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;" &amp; EndDate.Day &amp; "/" &amp; EndDate.Month &amp; "/" &amp; EndDate.Year &amp; "&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td nowrap style='width:70.2pt;border:solid windowtext 1.0pt; border-left:none;padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='94'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;" &amp; Reason &amp; "&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style='width:58.05pt;border:solid windowtext 1.0pt;border-left: none;padding:0in 5.4pt 0in 5.4pt;height:15.75pt' width='77'&gt; &lt;p align='center' class='MsoNormal' style='text-align:center'&gt; &lt;span style='color:black'&gt;" &amp; JMTS &amp; "&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:black'&gt;For your kind action if any .&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;Thanks!&lt;/p&gt;&lt;p class='MsoNormal'&gt;&amp;nbsp;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;&lt;p class='MsoNormal'&gt;&lt;span style='font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:black'&gt;&lt;img height='80' src=cid:companylogo width='52' /&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id='_x0000_t75' coordsize='21600,21600' o:spt='75' o:preferrelative='t' path='m@4@5l@4@11@9@11@9@5xe' filled='f' stroked='f'&gt;&lt;v:stroke joinstyle='miter' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:formulas&gt;&lt;v:f eqn='if lineDrawn pixelLineWidth 0' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='sum @0 1 0' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='sum 0 0 @1' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='prod @2 1 2' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='prod @3 21600 pixelWidth' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='prod @3 21600 pixelHeight' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='sum @0 0 1' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='prod @6 1 2' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='prod @7 21600 pixelWidth' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='sum @8 21600 0' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='prod @7 21600 pixelHeight' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;v:f eqn='sum @10 21600 0' xmlns:v='urn:schemas-microsoft-com:vml'/&gt;&lt;/v:formulas&gt;&lt;v:path o:extrusionok='f' gradientshapeok='t' o:connecttype='rect' xmlnsv='urn:schemas-microsoft-com:vml'/&gt;&lt;o:lock v:ext='edit' aspectratio='t' xmlns:o='urn:schemas-microsoft-com:office:office'/&gt;&lt;/v:shapetype&gt;&lt;![endif]--&gt;&lt;![if !vml]&gt;&lt;![endif]&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;span style='font-size:12.0pt;font-family:&amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:#9B5F9B'&gt;&lt;br /&gt;Contact Center Notifications on behalf of " &amp; Name &amp; "&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:&amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:black'&gt; &lt;/span&gt;&lt;span style='font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;'&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal' style='margin-bottom:12.0pt'&gt;&lt;span class='auto-style1'&gt;Headcount&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:&amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:#9B5F9B'&gt;&lt;br /&gt;&lt;br /&gt;Zain Jordan &lt;br /&gt;PO Box 940821, Amman 11194, Jordan&lt;/span&gt;&lt;span style='font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;'&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class='MsoNormal' style='margin-bottom:12.0pt'&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;" Try Dim SmtpServer As New SmtpClient() Dim mail As New MailMessage() SmtpServer.Credentials = New Net.NetworkCredential("CCNotifications@xxxxx.com", "xxxxxx") SmtpServer.Port = 25 SmtpServer.Host = "192.168.10.232" mail = New MailMessage() Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString(System.Text.RegularExpressions.Regex.Replace(EmailBody, "@&lt;(.|\n)*?&gt;", String.Empty), Nothing, "text/plain") Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(EmailBody, Nothing, "text/html") 'create the LinkedResource (embedded image) Dim logo As New LinkedResource("\\fastdell\users\sales\users\lo'ais\Head_Count\IMG\Zain_logo.jpg") logo.ContentId = "companylogo" 'add the LinkedResource to the appropriate view htmlView.LinkedResources.Add(logo) plainView.LinkedResources.Add(logo) mail.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8") 'add the views mail.AlternateViews.Add(htmlView) mail.AlternateViews.Add(plainView) mail.From = New MailAddress("CCNotifications@xxxx.com", "CC Notifications") For i As Integer = 0 To EmailTo.Length - 1 mail.To.Add(EmailTo(i)) Next For i As Integer = 0 To EmailCC.Length - 1 mail.CC.Add(EmailCC(i)) Next 'mail.Bcc.Add("wall.of.ey3s@gmail.com") mail.Subject = EmailSub mail.IsBodyHtml = True 'mail.Body = EmailBody SmtpServer.Send(mail) 'MsgBox("mail send") Catch ex As Exception MsgBox(ex.ToString) End Try Return Nothing End Function </code></pre> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload