This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -9,7 +6,6 @@ using System.Net.Mail;
|
||||
using System.Net;
|
||||
//for captcha:
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
@@ -72,12 +68,15 @@ namespace contact.Pages
|
||||
var blocks = new List<string>();
|
||||
blocks.Add("google");
|
||||
blocks.Add("jumboleadmagnet");//<--fuck this guy in particular, keeps spamming
|
||||
blocks.Add("boostleadgeneration");
|
||||
//ericjonesmyemail@gmail.com
|
||||
var companyname = Contact.Company.ToLowerInvariant();
|
||||
foreach (string s in blocks)
|
||||
{
|
||||
if (companyname.Contains(s))
|
||||
{
|
||||
goto skipspam;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +107,8 @@ namespace contact.Pages
|
||||
smtpClient.Port = 587;
|
||||
smtpClient.UseDefaultCredentials = false;
|
||||
//testing
|
||||
smtpClient.EnableSsl=true;
|
||||
|
||||
smtpClient.EnableSsl = true;
|
||||
|
||||
// smtpClient.Port=465;
|
||||
// smtpClient.DeliveryMethod= SmtpDeliveryMethod.Network;
|
||||
|
||||
@@ -127,8 +126,8 @@ namespace contact.Pages
|
||||
//Fastmail server names and ports help page: https://www.fastmail.help/hc/en-us/articles/1500000278342
|
||||
//APP Password created in fastmail for smtp use only labelled 'contact-form': cnea8agl6nlx5j7l
|
||||
|
||||
//try using from as support@onayanova.com
|
||||
//try domain version if this still won't work
|
||||
//try using from as support@onayanova.com
|
||||
//try domain version if this still won't work
|
||||
smtpClient.Credentials = new System.Net.NetworkCredential("support@onayanova.com", "cnea8agl6nlx5j7l");
|
||||
//******************************************************************************************************************
|
||||
//******************************************************************************************************************
|
||||
@@ -137,26 +136,27 @@ namespace contact.Pages
|
||||
}
|
||||
}
|
||||
|
||||
//SEND COPY TO CLIENT
|
||||
using (var message = new MailMessage())
|
||||
{
|
||||
message.To.Add(new MailAddress(Contact.Email));
|
||||
message.From = new MailAddress("support@ayanova.com");
|
||||
message.Subject = $"Confirmation that your question about AyaNova has been received from {Contact.Company}";
|
||||
message.Body = MessageBody;
|
||||
//Removed 2022-10-06 causing backscatter and also not helpful
|
||||
// //SEND COPY TO CLIENT
|
||||
// using (var message = new MailMessage())
|
||||
// {
|
||||
// message.To.Add(new MailAddress(Contact.Email));
|
||||
// message.From = new MailAddress("support@ayanova.com");
|
||||
// message.Subject = $"Confirmation that your question about AyaNova has been received from {Contact.Company}";
|
||||
// message.Body = MessageBody;
|
||||
|
||||
using (var smtpClient = new SmtpClient("smtp.fastmail.com"))
|
||||
{
|
||||
// using (var smtpClient = new SmtpClient("smtp.fastmail.com"))
|
||||
// {
|
||||
|
||||
smtpClient.Host = "smtp.fastmail.com";
|
||||
smtpClient.Port = 587;
|
||||
smtpClient.UseDefaultCredentials = false;
|
||||
smtpClient.EnableSsl=true;
|
||||
//NOTE: Do not use the noreply email address to send mail, it crashes the server somehow
|
||||
smtpClient.Credentials = new System.Net.NetworkCredential("support@onayanova.com", "cnea8agl6nlx5j7l");
|
||||
smtpClient.Send(message);
|
||||
}
|
||||
}
|
||||
// smtpClient.Host = "smtp.fastmail.com";
|
||||
// smtpClient.Port = 587;
|
||||
// smtpClient.UseDefaultCredentials = false;
|
||||
// smtpClient.EnableSsl=true;
|
||||
// //NOTE: Do not use the noreply email address to send mail, it crashes the server somehow
|
||||
// smtpClient.Credentials = new System.Net.NetworkCredential("support@onayanova.com", "cnea8agl6nlx5j7l");
|
||||
// smtpClient.Send(message);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user