||1. Problem in sending emails through SMTP classes
|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 :
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.Subject = msgSubject;
FMSMail.From = new MailAddress("firstname.lastname@example.org");
FMSMail.Body = msgBody;
catch (Exception ex)
Err = ex.Message;
if (Err.Length == 0)
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
There are 10 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.
Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.