Oscommerce Mail does not send for concatenated string - php

hi am new to oscommerce plat form,i have a task i.e once user check the mail means it will send to the user email address and admin email address else it will send mail to admin.the problem is here,once i did the condition means it wont send the mail for concatenate string.
My code is given below:
VARIABLE NAME:email_address=tep_db_prepare_input(HTTP_POST_VARS['email']);
tep_mail(STORE_OWNER,emailaddres."xxyt#somemail.com",EMAIL_SUBJECT,subject,message,name, email_address);
tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
here i want send the mail to user also.

HTTP_POST_VARS['email'] needs Register Globals to be on which in most servers these days is off( as its a security threat).
echo HTTP_POST_VARS['email'] and check are you getting some value or not else use $_POST['email']

Related

How can I append user input to an email address (domain part) when sending it to MySql with PHP?

Note: email address structure is local-part#domain.
For example I am asking user to provide his email:
<label>Your Gmail:</label><input type="email" name="emailaddress"><label>#gmail.com</label>
But instead of letting him/her type the complete email address (e.g. user#gmail.com), I want to let user type only local-part without domain. But how can I send this email to MySql database now? Basically I need to append custom input to #gmail.com every time user submits the form. For example, records in my database would look like user1#gmail.com, user2#gmail.com etc.
Can anyone help?
In PHP build a String like this.
$email = $_REQUEST['emailaddress'];
echo "$email#gmail.com";
if the value submitted by the form was john.smith, the output would be
john.smith#gmail.com
Read PHP 5 Form Handling to understand how to retrieve the parameters parsed by the form.
Tried in my local works perfect.
$email = $_POST['email'] //Text box value
$email = $email."#gmail.com";
You are required to do some concatenation like above

How to add unsubscribe link in mail when using Bcc

I am using the following code in controller to send newsletters to subscribers
$body = $model->letter_content;
$to_email = 'admin#site.in';
for($i=0;$i<count($msg_to);$i++){
$maitto = $msg_to[$i];
if($maitto != '')
$headers .= 'Bcc:'.$maitto."\r\n";
}
mail($to_email,$subject,$body,$headers);
the variable '$msg_to' contains all subscriber list as array.
The variable '$body' has the saved static newsletter body..
I am sending the mail to admin and adding all subscribers as 'Bcc' as I dont want to use mail function inside the for loop to send individually to all subscribers.
Now I want to add a link in the mail to allow subscribers to unsubscribe..If i was sending mail individually inside the for loop i could have used something like this inside loop before mail() function
$body .= 'UNSUBSCRIBE'
But since here i am using 'Bcc' is there any other way to do it.
Thank you.
You basically have two options in this case:
You could have the unsubscribe link take them to a page where they enter their email address.
You can find a way to start looping through each user to send the email individually, like you said you don't want to do.
One email can only have one set of content. Therefore, no matter how many people you send it to they all will get the same email.
If you really feel strongly about using the BCC field for everyone, option one will work fine.

No Such User Here error when sending via form

I have an online form that is being sent to my client's email. Unfortunately I am getting a "No Such User Here" error when submitted. If I test out the form on my email or my coworker's email, it works fine.
The email exists because they have told me they use it to send and receive other email.
Error looks like this:
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
<client's email>
No Such User Here
Edit: For what it's worth, here's my code. I'm using Processwire and using the Form Template Processor module. Which I've used before. This form works perfectly when sent to any email but my client's. I'm thinking this is more of an MX records thing which I'm not super well-versed in.
<?php
$form = $modules->get('FormTemplateProcessor');
$form->template = $templates->get('form'); // required
$form->requiredFields = array('first_name','last_name','company','email','phone');
$form->email = 'CLIENTS EMAIL'; // optional, sends form as email
$form->parent = $page; // optional, saves form as page
echo '<div class="form-header"><h2>Become a member today</h2></div>';
echo $form->render(); // draw form or process submitted form
?>
There are several reasons why you would get a "550 No Such User Here" error.
Mail file permissions are not readable or are incorrect.
The email address was typed incorrectly.
MX records are incorrect ( pointing to the wrong server ).
Email does not route correctly ( Remote / Local domains ).
To dig further kindly go through this article Source
Credits to the Source Poster #James Richardson

How to send email to two different email address in codeigniter

I am trying to send an email to two different email address using codeigniter email library.
$mail_array = array($email_address, 'example#yahoo.com');
$this->email->to($mail_array);
I have created an array which contains two email address.
The problem here is that the mail is sent only to one email address which is $email_address and not the other.
Can you guys help me on this.
Looks like your code is just fine but as to method accept an array or comma separated string, try change to comma separated string:
$this->email->to("$email_address, example#yahoo.com");
Note: Make you using real email instead of example#yahoo.com and see the documentation in case you missing anything.
Try the following code:
$mail_array = array($email_address, 'example#yahoo.com');
foreach($mail_array as $email) {
$this->email->to($email);
}
You can add second email to CC like,
$this->email->cc('email#email.com');
In CodeIgniter, sending email is not only simple, but you can configure it on the fly or set your preferences in a config file.
$this->email->to()
Sets the email address(s) of the recipient(s). Can be a single e-mail,
a comma-delimited list or an array:
$this->email->to('someone#example.com');
$this->email->to('one#example.com, two#example.com, three#example.com');
$this->email->to(
array('one#example.com', 'two#example.com', 'three#example.com') );
For more reference see this link - http://www.codeigniter.com/user_guide/libraries/email.html#class-reference
Hope this will help you !!

formmail to email in database

Here's what I need to setup...and I am not well versed in PHP/SQL...but this is what I'm trying to do.
On the New User database, I will have a section where they can have information sent to their phone using the provider's default e-mail to text msg (i.e. 2225551212#txt.att.net.)
New User:
Input number: ______________(2225551212 format, no hyphens, etc.)
Select Provider: (Drop-down menu with proper #provider.ext...)
Then the formmail, when sent, if for specific user will get ($phone".#."$provider); or something like that and send a preset message like:
$user."requested information on ".$product."on".$date." at ".$time.".";
Is this possible?
The $user, $product, $date, $time all are generated directly from the most recent input page for a database.
Is this possible?
Please help!
Assuming your question is "can I send a text message from PHP", then yes; if the server where you are running PHP is configured to send email, then within PHP you can try:
mail('2225551212#txt.att.net', 'New User', $user."requested information on ".$product."on".$date." at ".$time.".");
For more help with the mail() function, check out http://php.net/mail .

Categories