Jump to content

Mailing list error


tristaaaaaaaaa

Recommended Posts

Hey, I'm new at php so this is a little overwhelming for me.lol. Anyway, I am making mailing list so to put on a godaddy site. When I run the script though I get these errors.

 

Warning: mail() [function.mail]: SMTP server response: 553 Sorry, that domain isn't in my list of allowed rcpthosts. in C:\wamp\www\send.php on line 27

 

Warning: mail() [function.mail]: SMTP server response: 553 Sorry, that domain isn't in my list of allowed rcpthosts. in C:\wamp\www\send.php on line 27

 

Notice: Undefined index: mail_2 in C:\wamp\www\send.php on line 17

 

Notice: Undefined index: mail_3 in C:\wamp\www\send.php on line 17

 

Notice: Undefined index: mail_4 in C:\wamp\www\send.php on line 17

 

Notice: Undefined index: mail_5 in C:\wamp\www\send.php on line 17

All mail has been processed.

 

I think the problem is this line of code: but idk, that is the stmp address that godaddy gave me.

ini_set("SMTP", "smtpout.secureserver.net");

 

 

ANNNYYYWWAAY Here is all my code

:(

Send : Where The error is coming from -:( :

 

<?php

 

require('connect.php');

 

 

ini_set("SMTP", "smtpout.secureserver.net");

 

//standard mail header

$headers = "From: trista_edwards@theinspirationaldesign.com";

 

//get message to send

$message = $_GET['message'];

 

//loop through

for($x=0;$x<count($_GET);$x++)

{

if ($_GET["mail_$x"])

{

 

  //mail setup

  $to = $_GET["mail_$x"];

  $subject = "Newsletter";

  $body = "Dear ".$_GET["name_$x"]."

  \n\n $message \n\n

  Corporate Staffing.";

 

  mail($to, $subject, $body, $headers);

 

}

}

echo "All mail has been processed.";

?>

 

Connect :

<?php

 

$error = "Couldn't Connect";

 

 

$connect = mysql_connect("localhost", "root", "") or die($error);

mysql_select_db("CorporateStaffing");

?>

and index (user interface)

 

<?php

require('connect.php');

 

echo "<h1>Mailing List</h1><p>Send to</p>";

 

echo "<form action='send.php' method='GET'>";

 

$mailcount = 0;

$namecount = 0;

 

$get = mysql_query("SELECT * FROM mailinglist WHERE send='1'");

 

while ($getrow = mysql_fetch_assoc($get))

{

  echo "<input type='checkbox' name='mail_".$mailcount++."' value='".$getrow['email']."' CHECKED>".$getrow['firstname']." ".$getrow['lastname']." (".$getrow['email'].")

  <input type='hidden' name='name_".$namecount++."' value='".$getrow['firstname']."'><br>";

}

 

 

echo "<p>

Message:<br>

<textarea name='message'>Type your information here!</textarea>

<p>

<input type='submit' name='submit' value='Send'>

</form>";

?>

 

 

Link to comment
Share on other sites

The bottom line is that the smtp server they gave you, is treating the mail coming from your server as foreign, and will not allow your server to relay mail from it.

 

The notices are probably coming from this line:

 

  if ($_GET["mail_$x"])

 

because the prior loop attempts to access the checkbox GET params of 'mail_#' without knowing that the index exists.  In fact, the entire premise looks erroneous to me, since the count() of elements in the $_GET has no correlation to the items that are checked.  The way checkbox forms work, is that you'll get a $_GET param if the item is checked. 

 

Let's say you have 50 people in your list and you check # 50 which has the name of 'mail_50'.  The count() of $_GET params is going to be way less than 50, so that will never be processed.

 

A better solution to this is to use the array_keys() function to get the list of all the keys in the $_GET() and foreach() through that list looking for ones that match the 'mail_' pattern, to process.

 

 

 

Link to comment
Share on other sites

The bottom line is that the smtp server they gave you, is treating the mail coming from your server as foreign, and will not allow your server to relay mail from it.

 

The notices are probably coming from this line:

 

  if ($_GET["mail_$x"])

 

because the prior loop attempts to access the checkbox GET params of 'mail_#' without knowing that the index exists.  In fact, the entire premise looks erroneous to me, since the count() of elements in the $_GET has no correlation to the items that are checked.  The way checkbox forms work, is that you'll get a $_GET param if the item is checked. 

 

Let's say you have 50 people in your list and you check # 50 which has the name of 'mail_50'.  The count() of $_GET params is going to be way less than 50, so that will never be processed.

 

A better solution to this is to use the array_keys() function to get the list of all the keys in the $_GET() and foreach() through that list looking for ones that match the 'mail_' pattern, to process.

 

 

......i'll try and figure that out.lol. Thanks you for at least answering, now I am going to stare at your responce, drool over myself, maybe slap as well, and try and get this right.

Link to comment
Share on other sites

When 'I' use the GoDaddy mail function, I skip the variables in it, i.e. instead of

mail($to, $subject, $body, $headers);

,

I use

mail('blah@blah.com', 'ere', 'erer', 'werd');

 

I don't know, and I am really sorry if this is irrelevant, but any other format doesn't work on GoDaddy with me.

 

I hope that this is helpful!

Link to comment
Share on other sites

When 'I' use the GoDaddy mail function, I skip the variables in it, i.e. instead of

mail($to, $subject, $body, $headers);

,

I use

mail('blah@blah.com', 'ere', 'erer', 'werd');

 

I don't know, and I am really sorry if this is irrelevant, but any other format doesn't work on GoDaddy with me.

 

I hope that this is helpful!

 

This would make sense, because in many cases, the server would already be configured to send mail via whatever MTA exists on the server.  Although spam filters can be a huge issue, when you're talking about low cost hosting, you typically can't expect to get the type of configuration you would have on a dedicated server or VPS where you run your own dns.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.