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 .
Related
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
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
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']
Hoping some of you out there are great with php!
Basically the guy who made this is MIA so I can't ask him what I need to do to fix the problem we are having.
Background:
We are a locksmith company that uses a custom web app to inform our locksmiths on the road when they have a new job. This web app also does a few extra things like providing gps location, time taken at the job and the ability to have save signature from the client upon work completion.
Problem:
The app works by picking up an email sent from our account management application called E3, the email (example: http://cl.ly/image/2E433O330T0N) is read by this web app, parsed into both an email and a web page and sent to the locksmith to view his new job. When the locksmith arrives at the web page on his phone (example: http://cl.ly/image/0P1I0R0h0O3K), he can see the job details including the Name, address and contact details for the client. The problem is though, because Job Notes isn't assigned a heading in the original email the code has to work out where Job Notes is located, this is the part that has the problem as the web app is no longer showing the data in Job Notes. Job Notes is important because it tells the locksmith what he needs to fix. This worked previously but has now just stopped working and we aren't sure why.
How the data is transferred to the web app is very interesting, instead of having a database to store data to, it is put in the address bar and then the webpage interprets the code and formats it into the page.
For example, this is how the current link looks (data taken out, replaced with xxxxxxx):
http://www.xxxxxxx.com/apps/xxxxxx/on-my-way?client=xxxxxx&company=xxxxxx&mobile=xxxxxxx&phone=xxxxxxx&contact=xxxxxxxx&addressData=Array&addressIndex=3&streetAddress=xxxxxxxxx&addressLocality=xxxxxxxx&postcode=xxxxxxx&city=xxxxxxx&clientEmail=&jobDate=11/22/2012&jobTime=1:30:00%20PM&jobID=xxxxxx&jobAMPM=PM&adminEmail=xxxxxxx&noreplyEmail=xxxxxxxxxx&companyPhone=xxxxxxxx&staffEmail=xxxxxxxx&staffName=xxxxxxx&staffPhone=xxxxxxxx
Previously, when working, this link had a jobNotes field added:
http://www.xxxxxxxx.com/apps/xxxxxxxx/on-my-way?client=xxxxxxxx&company=xxxxxxxx&mobile=xxxxxxxx&phone=&contact=xxxxxxxx&addressData=Array&addressIndex=4&streetAddress=xxxxxxxx&addressLocality=xxxxxxxx&postcode=xxxxxxxx&city=xxxxxxxx&clientEmail=xxxxxxxx&jobNotes=Quote%20on%20installing%20new%20keying%20system%0A%0AAlso%20would%20like%20a%20Quote%20on%20Install%20CCTV%0A%0ASub%20Total%3A%202%2C236.36%0AGST%3A%20223.64%0ATotal%3A%202%2C460.00%0A%0AMISC&*jobDate=11/19/2012*&jobTime=2:00:00%20PM&jobID=xxxxxxxx&jobAMPM=PM&adminEmail=xxxxxxxx&noreplyEmail=xxxxxxxx&companyPhone=xxxxxxxx&staffEmail=xxxxxxxx&staffName=xxxxxxxx&staffPhone=xxxxxxxx
The code:
This is an extract from e3-parser.php, the main file that translates the data from the e3 email to the web app.
// Job notes
if ($this->clientEmail) {
// REMOVED NOW THAT EMAIL IS BEING PUT ON THIRD LINE OF ADDRESS
// // If customer email present grab everything after it save it as job notes
// preg_match("/$this->clientEmail[^-]+/",$e3Output,$matches);
// $result = implode("",$matches);
// $notes = trim(str_replace($this->clientEmail,'',$result));
// $this->jobNotes = rawurlencode($notes);
// } else {
// Fall back to grabbing everything after the time
preg_match("/AM[^-]+/",$e3Output,$matchesAM);
preg_match("/PM[^-]+/",$e3Output,$matchesPM);
$resultAM = implode("",$matchesAM);
$resultPM = implode("",$matchesPM);
$notes = trim(str_replace('AM','',$resultAM) . str_replace('PM','',$resultPM));
$this->jobNotes = rawurlencode($notes);
}
Question here is, does it successfully grab the data listed after the Required Time field? (example email that it's reading from: http://cl.ly/image/2E433O330T0N)
Here is the code that places the parsed data into the web page:
// Create job link
$url = $e3->create_job_url('http://www.prvgroup.com.au/apps/jobbook/on-my-way?');
$linkName = "View job details";
$href = '<a class="btn btn-small" href="' . $url . '&staffEmail=' . $staff- >staffEmail . '&staffName=' . $staff->staffName . '&staffPhone=' . $staff->staffPhone . '">' . $linkName . '</a>';
This is sent to the locksmith via email informing him of his new job on the clickable link "View job details". The link is impregnated with the data needed. However from the looks of it the data for jobNotes isn't there. My backups of this code display the exact same thing here when the code was displaying jobNotes so I'm not exactly sure how it is putting that field in.
If you got this far, well done! I hope I was clear enough with what the issue is but if you need anymore clarification, just ask!
Cheers,
Marc
After looking through your code you are only running the preg_match if there is a clientEmail. From the sample emails above it does not look like you are ever executing this code because there is no client email or it is not found using the preg_match. The specific location to look into is on line 113 of the e3-parser.php file. You will see this:
if($this->clientEmail)
{
//matching code here.
}
on line 109 and 110 you are looking for an email address and either not finding one or it is looking in the wrong location. At any rate, you should execute this code regardless of whether there is an email address or not. The notes must be set for later use, right now nothing is being set. Removing this if statement should resolve your issue.
I'm using Drupal autoresponder module - and I want to use tokens so I can include the username who has subscribed within the emails being sent...
Does anybody know how this can be achieved?
Thanks for any help.
Shane
Thanks for that - your answer was very close....
The autoresponder module UID is not related to the user UID so your code was bringing in a different username... So I changed it to find the user from the email address instead.
// load the full user object
$user = user_load(array('mail' => $u->mail));
// Replace user tokens in mail body
$mail->body = token_replace($mail->body, 'user', $user);
Yes indeed, I'll submit it as a patch to my other request, and hopefully it may help somebody else.
Many Thanks
Shane
EDIT after separate answer by OP: The following was based on the assumption that the $u->uid refers to the 'standard' Drupal user id, which is not correct! So one has to find the corresponding Drupal user by other means, if possible - see the OPs answer for details on this...
I have not tested it, but looking at the autoresponder source code, you should be able to add (user) token replacement in the autoresponder_mail() function by inserting the following code before the preparation of the plain text body (before line 392 in the 6.x-1.0-alpha1 release):
// load the full user object
$user = user_load($u->uid);
// Replace user tokens in mail body
$mail->body = token_replace($mail->body, 'user', $user);
Alternatively, you could do it one function call earlier in autoresponder_cron(), within the while ($message db_fetch_object($result_messages)) loop, before the if (autoresponder_mail($u, $message)) call (line 366), using $message instead of $mail:
// load the full user object
$user = user_load($u->uid);
// Replace user tokens in mail body
$message->body = token_replace($message->body, 'user', $user);
In case this works, you might want to submit it as a patch to the already existing feature request for this. (I guess you are the 'keyzo'/'shane' who already answered there ;)
If it works and you are going to create a patch, it would be 'standard' practice to add the hint on possible token replacement to the message definition form(s) in autoresponder_mail_edit_create_form().