I am connecting to a remote server using proper email address and password and trying to use their SMTP email server for sending emails from that server but it is giving me errors.
Below is few sample of examples tried :
rsidemos.com/hfzasms/smtp1/
rsidemos.com/hfzasms/smtp2/
Both of them are giving connection errors.
At the same time - i am doing the same email sending activity using C# code and it is working fine. Below is the C# code i am using :
___________________________________________________________________________
public static bool SendEmail(string msgTo, string msgSubject, string msgBody, bool isBodyHTML,out string Err,string Heading)
{
Err = string.Empty;
SmtpClient scFMSMail = new SmtpClient();
scFMSMail.Host = "mail.domain.com"; scFMSMail.EnableSsl = true;
scFMSMail.UseDefaultCredentials = false; scFMSMail.Port = 587;
scFMSMail.Credentials = new NetworkCredential("username", "password");
MailMessage FMSMail = new MailMessage();
FMSMail.To.Add(new MailAddress(msgTo));
FMSMail.Subject = msgSubject;
FMSMail.From = new MailAddress("abc@abc.com");
FMSMail.Body = msgBody;
try
{
scFMSMail.Send(FMSMail);
}
catch (Exception ex)
{
Err = ex.Message;
}
if (Err.Length == 0)
return true;
else
return false;
}
___________________________________________________________________________
Can anyone advise on the reason - why is it working fine in c# and not in php? I can also share the php code but those are multiple files and there is no file uploading facility here