Tag: 电子邮件

无法连接到“本地主机”端口25的邮件服务器

当我尝试使用PHP发送电子邮件时,出现此错误: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\dressoholic\register.php on line 50 我的php.ini如下所示: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = you@yoursite.com […]

使用C#通过SMTP发送电子邮件

我不明白为什么这个代码不工作。 我收到一个错误,说不能分配属性 MailMessage mail = new MailMessage(); SmtpClient client = new SmtpClient(); client.Port = 25; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Host = "smtp.gmail.com"; mail.To = "user@hotmail.com"; // <– this one mail.From = "you@yourcompany.com"; mail.Subject = "this is a test email."; mail.Body = "this is my test email body"; client.Send(mail);