Mark Tabor

Mark Tabor

  • 585
  • 2k
  • 460.8k

Sent an email using Shared hosting mail address provided by

Aug 8 2016 3:14 AM
I have purchased a domain + hosting from Nexus , Now they have given me ten pop up accounts i have to send an email to different domain address like gmail,hotmail,yahoo and some other company specific domains, M i able to send an email by giving my hosting mail server domain Ip and port number into my code and providing the email credentials , I have tried that but some times it send email some times it give an error that cannot connect to the server , when I contact the hosting provider they said that You cannot send an email by that provided mail server , because you have a shared hosting . I think this should nt be like that , below is my code to send an email<br /><p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas;color:blue">Private</span><span style="font-size: 9.5pt;font-family:Consolas"> <span style="color:blue">Sub</span> SendHtmlFormattedEmail(<span style="color:blue">ByVal</span> recepientEmail <span style="color:blue">As</span> <span style="color:blue">String</span>, <span style="color:blue">ByVal</span> subject <span style="color:blue">As</span> <span style="color:blue">String</span>, <span style="color:blue">ByVal</span> body <span style="color:blue">As</span> <span style="color:blue">String</span>)</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> <span style="color:blue">Dim</span> mailMessage <span style="color:blue">As</span> System.Net.Mail.<span style="color:#2B91AF">MailMessage</span> = <span style="color:blue">New</span> System.Net.Mail.<span style="color:#2B91AF">MailMessage</span></span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> mailMessage.From = <span style="color:blue">New</span> <span style="color:#2B91AF">MailAddress</span>(<span style="color:#2B91AF">ConfigurationManager</span>.AppSettings(<span style="color:#A31515">"UserName"</span>))</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> mailMessage.Subject = subject</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> mailMessage.Body = body</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> mailMessage.IsBodyHtml = <span style="color:blue">True</span></span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> mailMessage.To.Add(<span style="color:blue">New</span> <span style="color:#2B91AF">MailAddress</span>(recepientEmail))</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> mailMessage.From = <span style="color:blue">New</span> <span style="color:#2B91AF">MailAddress</span>(<span style="color:#A31515">"[email protected]"</span>)</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> <span style="color:blue">Dim</span> smtp <span style="color:blue">As</span> <span style="color:#2B91AF">SmtpClient</span> = <span style="color:blue">New</span> <span style="color:#2B91AF">SmtpClient</span></span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> smtp.Host = <span style="color:#A31515">"IP"</span></span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> smtp.EnableSsl = <span style="color:blue">False</span></span></p> <p><span style="font-size: 9.5pt;font-family:Consolas"> smtp.Credentials = <span style="color:blue">New</span> System.Net.<span style="color:#2B91AF">NetworkCredential</span>(<span style="color:#A31515">"[email protected]"</span>, <span style="color:#A31515">"Password"</span>)</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> smtp.Port = PortNumber</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> smtp.Send(mailMessage)</span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> </span></p> <p style=" 0.0001pt;"><span style="font-size: 9.5pt;font-family:Consolas"> <span style="color:blue">End</span> <span style="color:blue">Sub</span></span></p>

Answers (2)