If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
-
D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Post
by D Oliveira » 2020-09-06 18:38
Hi, can anyone diagnose why this code is always leading this email to spam? is there any alternative to the mail() function that would be better for this purpose?
Thank you.
Code: Select all
$to = $email;
$subject = $name." - Bem Vindo ao Fitbook";
$message = "
<html>
<head>
<title>Bem vindo ao Fitbook!</title>
</head>
<body>
<div style='text-align: center'><img style='width: 250px' src='https://fitbookapp.net/fitbook/logon.png?c=9' /></div>
<table align='center'>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n"."
<tr>
<td align='center'> Olá ".$name.", bem vindo ao Fitbook App!</td>
</tr>
<p><br/></p>". "\n" . "
<tr>
<td align='center'> Seguem abaixo suas credenciais de acesso: </td>
</tr>
</table>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "\n"."
<table align='center'>
<tr>
<th align='center'>Usuário</th>
</tr>
<tr>
<td align='center'>".$email."</td>
</tr>
<p> </p>
</table>
<table align='center'>
<tr>
<th align='center'>Senha</th>
</tr>
<tr>
<td align='center'>fitbook</td>
</tr>
</table>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "\n"."
<table align='center'>
<tr>
<th align='center'>Acessar App</th>
</tr>
<tr>
<td align='center'>https://fitbookapp.net/fitbook/</td>
</tr>
<p> </p>
</table>
<p><br/></p>". "\n". "\n". "\n". "\n". "\n". "\n". "\n". "\n"."
<table align='center'>
<tr>
<th align='center'>Contato</th>
</tr>
<tr>
<td align='center'>[email protected]</td>
</tr>
</table>
<p> </p>
<div style='text-align: center'><img style='width: 25px' src='https://fitbookapp.net/fitbook/favicon.png?c=9' /></div>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <[email protected]>' . "\r\n";
mail($to,$subject,$message,$headers);
-
a.gneady
- Site Admin
- Posts: 1281
- Joined: 2012-09-27 14:46
-
Contact:
Post
by a.gneady » 2020-09-07 09:04
This is usually a tricky issue to diagnose. I see you're including a FROM header, and the sender domain is fitbookapp.net ... Is the server you're sending the email from serving the contents for that domain? If not, you should add its IP address in a DKIM record in your domain's DNS records.
Another issue. There is a missing space after the colon here:
Code: Select all
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
Should be:
Code: Select all
$headers .= "Content-type: text/html;charset=UTF-8" . "\r\n";
If the above fixes don't work for preventing flagging the email as spam, you should try to inspect the email headers at the recipient .. there might be a clue to why it got flagged.
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
-
D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Post
by D Oliveira » 2020-09-07 18:15
I contacted godaddy support and they magically fixed it lol can't share the exact resolution, but maybe if you have the same problem contacting your hosting might work for you as well
thanks ahmed
-
a.gneady
- Site Admin
- Posts: 1281
- Joined: 2012-09-27 14:46
-
Contact:
Post
by a.gneady » 2020-09-08 08:54
Glad it's fixed now
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.